Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 02, 2012 03:00 AM by Steven Cheng - MSFT
Mar 29, 2012 05:27 PM|LINK
I'm setting up bare bones hello world WCF service, using the Visual Studio WCF Service Application template. I removed the "value" parameter from the out-of-the-box GetData function, so that it can take a "bare" GET request.
But I keep getting this error:
"The message with To 'http://<my hostname>/service1.svc/getdata' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.
To get rid of this error, I have to add a behaviorConfiguration property to the service element in web.config. Why doesnt the webHttpBinding have this behavior inbuilt? Moreover, if I try to use wsHttpBinding, I get 400, bad request. Please note I'm making all requests through IE address field, not a WCF client:
<behavior name="my"> <webHttp defaultBodyStyle="Bare"/> </behavior> </endpointBehaviors>
Mar 30, 2012 08:25 AM|LINK
Remove the address in your endpoint. When you host a WCF service in IIS, it is reachable at the URL of the .svc-file.
Mar 30, 2012 09:01 PM|LINK
Thanks mm10. Good point. Could you please tell me why I need to add a behaviorConfiguration to get rid of the error:
The message with To '<myhostname>/Service1.svc/getdata' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree.
Mar 30, 2012 09:11 PM|LINK
The WebHttpBehavior provide the correct networking stack for using REST. You can read more in this article:
Does your service work now or do you still get the same error message?
Mar 30, 2012 09:21 PM|LINK
The service works, it has been working, My original question is that it does not work if I remove the following custom behaviorConfiguration:
Mar 31, 2012 08:58 AM|LINK
The WebHttpBehavior behavior is used in conjunction with the WebHttpBinding to expose and access services accessed from the web.
If you use a WebHttpBinding without the WebHttpBehaviour, you will get a HTTP 500 Internal Server Error. The error message you are mentioning will probably become a 500 Internal Server error if you remove the address from endpoint configuration.
Apr 02, 2012 03:00 AM|LINK
As mm10 has explained, the <webHttp> behavior element helps inject some webHttpBinding(restful binding for WCF) specific extensions so that the underlying service/endpoint processing stack get changed to fit the RESTful programming model.
By default, SOAP/XML based message processing mechansim is used and as the error you have encounterred. SOAP/XML based messaging will rely on some SOAP specific feature(like the soapAction header in message) to determine which operation an incoming request
is targeting. While for REST/web style service, the request URL itself has indicated the target operation it want to invoke.
Here are some further reference about WCF REST programming model:
#WCF RESTful Programming Model
#WCF Web HTTP Programming Model Overview
BTW, for creating WCF REST style service, you can also use the predefined Visual Studio template below:
#WCF REST Service Template 40(CS)