Rest Wcf service
I am trying to test my Rest Wcf service from the Browser. WhenI am trying to send some values from browser I am getting the following error. "The message cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher.
Check that the sender and receiver's EndpointAddresses agree."Then I added [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]. then I am getting a different error.
"Due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.
Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None)."Can we pass values to a Rest Wcf Service from a browser??
I am trying to passing following values from the browser.
http://mywebsite/Service1.svc/mymethod/Firstname,Lastname,LosAngles,CA
here is my web.confg file
<system.serviceModel>
<se开发者_运维百科rvices>
<service behaviorConfiguration="Wcfservice1.ServiceBehavior" name="="Wcfservice1.Service1">
<endpoint address="" binding="webHttpBinding" contract="Wcfservice1.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Wcfservice1.ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
It looks like you didn't enable the <webHttp/>
behavior on the REST endpoint. Add this inside the <behaviors/>
element in your config file:
<endpointBehaviors>
<behavior name="REST">
<webHttp />
</behavior>
</endpointBehaviors>
Then, change the <endpoint/>
element like this:
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="REST" contract="Wcfservice1.IService1">
精彩评论