Infosys Microsoft Alliance and Solutions blog

« Silverlight Theming | Main | .NET Framework 4.0 CLR Enhancements »

Configuring WCF on IIS 7

 We have been on Silverlight (SL) for sometime now on an internal project. During the development, we were mostly relying on the ASP.NET Web server. However for a review when we decided to host the application on IIS, we realized that the WCF service wasn't working on it. The machine was a Vista box with IIS 7 and since .net 3.0 comes pre-installed, we had assumed that WCF will also just work.

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=, 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=, 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.




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!

Bart, glad this helped.

Thanks for this post. Saved me a lot of time. (I didn't spend 2 days on it like Bart though) Maybe 15 minutes :-)

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Please key in the two words you see in the box to validate your identity as an authentic user and reduce spam.

Subscribe to this blog's feed

Follow us on

Blogger Profiles

Infosys on Twitter