Configuring WCF on IIS 7
However when we configured the specific applications on IIS, and tried to browse to the WCF's SVC file, we got a 404.3 as seen in the figure below.
Essentially what this shows is that IIS isn't configured correctly and when you try to access the service details by accessing the SVC file, IIS is unaware on how to handle this request. The resolution shown here can be a bit misleading. The mime map option isn't right since what we want is to be able to execute the SVC file on server and not really return it as some kind of stream from IIS. For execution, appropriate http module and handlers need to be registered with IIS. This can be done via the IIS Admin console or directly editing the applicationHost.config file (filepath - C:\Windows\System32\inetsrv\config). The following changes are required.
Add the following handlers to the file inside of section "<location path="" overrideMode="Allow">"
<add name="svc-ISAPI-2.0" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
<add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode" />
and also in the same section add the following module
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
While you can manually change the file to do this, it is much easier to do this via the "Turn Windows features on or off" (via Control panel). Apart from the config file changes, there could be other configurations related to specific security settings etc (I haven't tried to find out as yet) could be required that will be taken care via this setup.
The "Windows Communication Foundation HTTP Activation" is not enabled by default. You can check that and click OK and this will do the necessary configurations along with making the changes to the applicationHost.config file as I mentioned above.
With these done, when I browsed my service's SVC file again. I got the familiar screen as seen below and got the service working fine.
HTH.
Comments
After 2 days of researching and testing different suggestions, this solution finally solved my problems with the dreaded asp .net ajax undefined error. I cannot stress how valuable this has been for me. It's because of quality information like this, that people are empowered by the net every single day. Thank you!
Posted by: Bart Andre | December 6, 2008 3:36 PM
Bart, glad this helped.
Posted by: Atul Gupta | December 8, 2008 3:45 AM
Thanks for this post. Saved me a lot of time. (I didn't spend 2 days on it like Bart though) Maybe 15 minutes :-)
Posted by: Michael Bruce | March 3, 2009 5:02 PM