-
February 19th, 2014, 08:13 PM
#1
How to test a WCF SyndicationFeed application?
I'm following this tutorial (link: http://msdn.microsoft.com/en-us/libr...v=vs.110).aspx on the Microsoft site, but it doesn't tell me how to test the application...
When I run it in the WCF Test Client, it says I can't execute the method because it uses the ServiceModels.Syndication, so I tried to paste the localhost url into a browser but that doesn't work.
Can anyone familiar with WCF help me out?
When I used the port 8000 in that tutorial, it says can't connect to server. But when I use the port that appears in the WCF test client, it says:
Code:
"The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
Detailed Error Information:
Module: IIS Web Core
Notification: MapRequestHandler
Handler: StaticFile
Error Code: 0x80070002
Last edited by Arjay; February 19th, 2014 at 11:12 PM.
Reason: Fixed up url
-
February 19th, 2014, 11:13 PM
#2
Re: How to test a WCF SyndicationFeed application?
From the article:
To call GetBlog() with an HTTP GET
1.
Open Internet Explorer, type the following URL, and press ENTER: http://localhost:8000/BlogService/GetBlog. The URL contains the base address of the service (http://localhost:8000/BlogService), the relative address of the endpoint, and the service operation to call.
In other words, don't use WCF Test Client to test.
-
February 19th, 2014, 11:53 PM
#3
Re: How to test a WCF SyndicationFeed application?
Yes, like I mentioned in my post, I did that too but it didn't work..
-
February 20th, 2014, 01:39 AM
#4
Re: How to test a WCF SyndicationFeed application?
Originally Posted by jjwooyoung
Yes, like I mentioned in my post, I did that too but it didn't work..
I missed that you tried it in the browser.
On Win7 and newer machines, you need to run the app (or Visual Studio) as an admin.
Or you can register the port with netsh - something like
Code:
netsh http add urlacl url=http://+:8000/BlogService/ user=domain\username listen=yes
Btw, based on the help link that shows up in the WCF Test client:
"For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455."
I added the following to the code in an attempt to read the service from the WCF Test client:
(add this between the try { statement and the svcHost.Open() statement)
Code:
// Check to see if the service host already has a ServiceMetadataBehavior
var smb = svcHost.Description.Behaviors.Find<ServiceMetadataBehavior>();
// If not, add one
if (smb == null)
smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
svcHost.Description.Behaviors.Add(smb);
// Add MEX endpoint
svcHost.AddServiceEndpoint(
ServiceMetadataBehavior.MexContractName,
MetadataExchangeBindings.CreateMexHttpBinding(),
"mex"
);
// Add application endpoint
svcHost.AddServiceEndpoint(typeof(IBlog), new WebHttpBinding(), "");
Even after adding this, the WCF Test Client didn't work (which leads me to believe that the test client doesn't work on RSS feeds).
The good new is that the browser reads it fine after running the service as an admin or using netsh.
Last edited by Arjay; February 20th, 2014 at 02:03 AM.
-
February 20th, 2014, 11:23 AM
#5
Re: How to test a WCF SyndicationFeed application?
How are you running it? Did you first click debug and it opens it up in the browser? And are you using the port 8000 (my default IIS port is 58047 - should I change it)?
Whenever I click debug it opens up the WCF Test Client, so then I just paste the url in the browser but it keeps saying can't connect to the server
Last edited by jjwooyoung; February 20th, 2014 at 11:26 AM.
-
February 20th, 2014, 12:00 PM
#6
Re: How to test a WCF SyndicationFeed application?
Open Visual Studio as an admin.
Create a new console app project.
Paste the code from the link in.
Press F5 to start debugging. Note: if you are debugging with break points, you need to let the program run up to the Console.ReadLine() statement.
Take the url ending with /GetBlob and past it in the browser.
I'm using the code per the link, so that means port 8000.
-
February 20th, 2014, 12:02 PM
#7
Re: How to test a WCF SyndicationFeed application?
Originally Posted by jjwooyoung
How are you running it? Did you first click debug and it opens it up in the browser? And are you using the port 8000 (my default IIS port is 58047 - should I change it)?
Whenever I click debug it opens up the WCF Test Client, so then I just paste the url in the browser but it keeps saying can't connect to the server
Btw, it sounds like you have created a WCFService application instead of a console app.
That's ultimately where you want to be, but start by getting code running as a console app first.
-
February 20th, 2014, 10:10 PM
#8
Re: How to test a WCF SyndicationFeed application?
I've created it as a console app. But now it says "ServiceModel does not exist in the namespace System". So now I can't use the SyndicationFeed or Rss20FeedFormatter
edit: Nevermind, I just had to add the references to the project.
edit 2: So, I'm assuming to use the rss data, I'd have to bind it to a MVC or WPF application?
Last edited by jjwooyoung; February 20th, 2014 at 10:23 PM.
-
February 21st, 2014, 01:35 AM
#9
Re: How to test a WCF SyndicationFeed application?
You can use WCFStorm.Rest to this.
To call GetBlog() with an HTTP GET
Open WcfStorm.Rest.exe, type the http://localhost:8000/BlogService/GetBlog URL in the address box then press F5 or click on the send button.
The feed will be displayed in the response panel.
See here for a quickstart guide: http://www.wcfstorm.com/wcf/wcfstorm...art-guide.aspx
-
February 21st, 2014, 09:17 AM
#10
Re: How to test a WCF SyndicationFeed application?
Originally Posted by jjwooyoung
edit 2: So, I'm assuming to use the rss data, I'd have to bind it to a MVC or WPF application?
You can bind it to any app including mobile. I believe the sample in the link you provide is binding it to the same console client app that is hosting the service (see the code right before the Console.ReadLine statement.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|