Quantcast
Channel: User Alexis Abril - Stack Overflow
Viewing all articles
Browse latest Browse all 43

Hosting a WCF Atom feed in IIS

$
0
0

I have a simple Atom 1.0 feed that I've generated, similar to the example shown on MSDN.

However, instead of creating a host and testing the feed via console application, as in the example, I'm attempting to create the endpoint via configuration.

My configuration is as follows:

<system.serviceModel><services><service                name="MyNamespace.MyService"                behaviorConfiguration="returnFaults"><endpoint                    address=""                    binding="basicHttpBinding"                    contract="MyNamespace.IMyGenericService"></endpoint><endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/></service></services><behaviors><serviceBehaviors><behavior name="returnFaults"><serviceMetadata httpGetEnabled="true"/><serviceDebug includeExceptionDetailInFaults="true"/></behavior></serviceBehaviors></behaviors></system.serviceModel>

When I run my WCF service, I'm able to access the stock description page and even use this address as a service reference. However, if I attempt to call the method that returns the feed(http://localhost:SomeVSPort/MyService/GetFeed), I get a blank page with no errors. Setting a breakpoint in the method was unsuccessful as the method does not seem to be getting called.

My question is, how should I be exposing this feed for hosting via IIS? Should I be using a different configuration for my endpoint?

For reference, my service declaration follows:

namespace MyNamespace{    [ServiceContract]    public interface IMyGenericService    {        [OperationContract]        [WebGet]        Atom10FeedFormatter GetFeed();    }    public class MyService: IMyGenericService    {        public Atom10FeedFormatter GetFeed()        {            SyndicationFeed feed = new SyndicationFeed();        //SimpleEntry is a local class that holds location information in a GeoRSS Simple format.            IList<SimpleEntry> entries = new List<SimpleEntry>()            {                new SimpleEntry() { ID = "1", Point = "45.256 -71.92", Title = "Point 1" },                new SimpleEntry() { ID = "2", Point = "-71.92 45.256", Title = "Point 2" }            };            feed.Items = entries                .Select(e => new SyndicationItem()                {                    Content = new XmlSyndicationContent("application/xml",                        new SyndicationElementExtension(e)),                    Title = new TextSyndicationContent(e.Title),                    Id = e.ID                });            return new Atom10FeedFormatter(feed);        }    }}

Viewing all articles
Browse latest Browse all 43

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>