tags:

views:

3313

answers:

2

I've built a WCF service that's exposed both through SOAP and RESTfully. All SOAP actions work as advertised. GETS/PUTS do as well, but when I try to do a POST to an action in my service, I get the following error returned:

"Endpoint not found"

IPersonEditServiceContract snippet:

[OperationContract]
[WebInvoke(Method="POST", 
   UriTemplate="/persons", 
   RequestFormat=WebMessageFormat.Xml, 
   ResponseFormat=WebMessageFormat.Xml)]
SavePersonResponse SavePerson(SavePersonRequest request);


[OperationContract]
WebGet(UriTemplate = "/persons/{personId}",
   ResponseFormat = WebMessageFormat.Xml,
   BodyStyle = WebMessageBodyStyle.Bare,
   RequestFormat = WebMessageFormat.Xml)]
Person GetClaimantById(string personId);

Service is configured this way:

<behaviors>
   <endpointBehaviors>
    <behavior name="restBehavior">
     <webHttp />
    </behavior>
   </endpointBehaviors>
</behaviors>
<services>
  <service>
    <endpoint address="" binding="basicHttpBinding" 
        name="DefaultEndpoint"
        bindingNamespace="http://mycompany.com/ServiceContracts"
        contract="IPersonEditServiceContract" />
     <endpoint 
         address="rest" binding="webHttpBinding"
         name="RESTEndpoint" 
         bindingNamespace="http://mycompany.com/ServiceContracts"
         contract="IPersonEditServiceContract" 
         behaviorConfiguration="restBehavior"/>
  </service>
</services>

Since I can do other RESTful operations against the same endpoint, I'm not entirely sure why it gives me that semi-helpful error.

Ideas?

+1  A: 

I would think WCF is giving the error because it really can't find the endpoint. Are you hitting it using POST to the right URL under /rest? Try Fiddler to create POST call.

eed3si9n
it magically went away; have no idea what the problem was. but, since you're the only one that answered, thanks! BTW, I use fiddler for simple tests, really like soapUI for building some mocks and test projects from a similar angle.
joshua.ewer
A: 

I have the same issue. Can you give me the list of things you tried? Did you try reinstalling .net 3.5? or perhaps iis?

I'm running iis 7.5 with windows 7. I've got .net 3.5.

I'm thinking about upgrading to 4.0 to see if that solves any issues.

ryanconnellyatl