Thursday, March 29, 2012

Deploying WCF Service on IIS 6.0

After deploying WCF service to IIS 6.0, we will notice that the page will not load when requesting http://mydomain.com/myservice.svc instead we would get 404 page not found exception. If you place a sample HTML file in the same directory and try to visit the page, the page will show up.

 

After googling, I learnt that after installing .NET Framework 4.0 Client Profile redistributable in the server, by default the ASP.NET 4.0 ISAPI extension is not enabled. This can be determined using the following command in the command prompt:

 

C:\>cscript c:\WINDOWS\system32\iisext.vbs /ListFile

 

Executing the above command will list all the extension files of IIS as

 

Status / Extension Path
------------------------
0  C:\WINDOWS\system32\inetsrv\httpodbc.dll
0  C:\WINDOWS\system32\inetsrv\ssinc.dll
0  C:\WINDOWS\system32\inetsrv\asp.dll
1  C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll
1  C:\WINDOWS\system32\MQISE.DLL
0  C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll

 

From the above listed extension files, you will see that the status is 0 for aspnet_isapi.dll of ASP.NET Framework 4.0. This means it is not enabled and this is preventing ASP.NET 4.0 processing your request. To enable the extension use the following command:

 

C:\>cscript c:\WINDOWS\system32\iisext.vbs /EnFile C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll

 

Once the above command is executed successfully, you should be able to see your WCF service coming up in the browser.