I'm trying to host a WCF service in IIS7 that works with both Silverlight and for GET requests. I have the Silverlight endpoint working but can't work out how to create an additional endpoint on the same service that will handle GET requests from AJAX clients.
I have a second service that is for GET requests only and it works fine so my question isn't about how to set up an endpoint for a GET requests but how to set up a service that has two endpoints one for Silverlight requests and one for GET requests.
My IIS web.config has:
<system.serviceModel>
<services>
<service name="MyAssembly.MyService">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="http://localhost/provisioning.svc" binding="basicHttpBinding" contract="MyAssembly.IMyService" />
<endpoint address="http://localhost/provisioningajax.svc" binding="webHttpBinding" contract="MyAssembly.IMyService" />
</service>
</services>
<system.serviceModel>
The provisioning.svc and provisioningajax.svc files hold the same thing which is:
<% @ServiceHost Service="MyAssembly.MyService" %>
The provisioning.svc endpoint works with my Silverlight clients ok but I can't get the provisioningajax.svc to work. When attempting to access it I get a Runtime error and the following error message in the Application Event Log.
Exception information: Exception type: InvalidOperationException Exception message: The ChannelDispatcher at 'http://localhost/provisioning.svc' with contract(s) '"MyAssembly.IMyService"' is unable to open its IChannelListener.