CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2014
    Posts
    6

    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

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    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.

  3. #3
    Join Date
    Feb 2014
    Posts
    6

    Re: How to test a WCF SyndicationFeed application?

    Yes, like I mentioned in my post, I did that too but it didn't work..

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: How to test a WCF SyndicationFeed application?

    Quote Originally Posted by jjwooyoung View Post
    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.

  5. #5
    Join Date
    Feb 2014
    Posts
    6

    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.

  6. #6
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    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.

  7. #7
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: How to test a WCF SyndicationFeed application?

    Quote Originally Posted by jjwooyoung View Post
    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.

  8. #8
    Join Date
    Feb 2014
    Posts
    6

    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.

  9. #9
    Join Date
    Feb 2014
    Posts
    1

    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

  10. #10
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: How to test a WCF SyndicationFeed application?

    Quote Originally Posted by jjwooyoung View Post
    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
  •  





Click Here to Expand Forum to Full Width

Featured