views:

81

answers:

1

I have a simple WCF service that we are developing... We are hosting in IIS7 on WinServer2k8 (though i cant get it to work in IIS7 on Win7 either)

I want multiple endpoints for the same service contract but have the endpoints behave differently. For example I want one endpoint to return data as XML and another to return data in SOAP messages.

Here is my web.config

  <system.serviceModel>

<services>
  <service name="MemberService">
    <endpoint address="soap" binding="basicHttpBinding" contract="IMemberService" />
    <endpoint address="xml" binding="webHttpBinding" contract="IMemberService" behaviorConfiguration="xmlBehavior" />
  </service>
</services>

<behaviors>
  <endpointBehaviors>
    <behavior name="xmlBehavior">
      <webHttp/>
    </behavior>
  </endpointBehaviors>
</behaviors>

In my service contract i have a method defined as:

        [OperationContract]
    [WebGet(UriTemplate = "members/{id}")]
    Member GetMember(string id);

When I deploy to IIS (on localhost) and make a request (with fiddler) to http://localhost/MemberService.svc/xml/members/memberid I receive a 404 error, also a 404 with http://localhost/MemberService.svc/soap/ However, http://localhost/MemberService.svc/members/memberid works and serializes the data as expected. We want to add the functionality of JSON in the near future as well, we thought it would be another endpoint with a different behavior. My web.config is modeled after a post i found on here

A: 

Following this tutorial....

I was able to quickly deploy the webservices. Then using fiddler I could change the content-type of the request to/from "text/xml" and "text/json" and the service would automatically return the data in the correct format.

Rob