Trying to configure WCF REST service hosted in IIS you may encounter an error message saying something like:
"The message with To '*' cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver's EndpointAddresses agree."
where '*' is the address you are trying to access. There are some answers here and there on the web but those are incomplete or hard to understand.
When using the "*.svc" file to host a service within ASP.NET web site, regular WCF ServiceHost is created. WCF itself does not understand the REST address (as specified by the UriTemplate property of WebGet attribute), so we should configure the proper endpoint behavior "webHttp".
So, here is how to configure WCF REST service to be hosted in IIS:
To host a service on IIS we are creating ".svc" file to map that file URL to the service type, for example:
<%@ ServiceHost Language="C#" Debug="true" Service="[ServiceFullTypeName]" %>
To enable this service as REST service, we will configure the required endpoint and behaviors in web.config:
Note that the "baseAddress" of this service is the URL to the ".svc" file, the "js" address is not required, but I prefer to distinguish between the "regular" address and the JSON address.