There are 3 main ways to deploy Windows Communication Foundation – WCF services to consume:
2- Windows Activation Service a.k.a WAS
3- Visual Studio .NET for development and dev testing purposes as part of a visual studio solution.
For full details about Windows Communciation Foundation deployment scenarios, categories and structure please refer to this MSDN article: http://msdn.microsoft.com/en-us/library/cc512374.aspx
This post is focusing on issues and problems faced with WCF running on IIS.
Recently, I had a working WCF service that I wanted to deploy on one of my client’s web servers. The webserver is a simple Windows 2008 web server with obviously web server role turned on.
After publishing the WCF service, I logged on the web server’s IIS 7 management console and started creating the webservice as a separate website. Please note that you may be able to create the web service as a web application under the default website or any website if you want (haven’t tried it before but should work). But do NOT do this if your default website is a Microsoft Dynamics CRM application server. Reason being that if you do add a webservice under Microsoft Dynamics CRM website, you will probably cause problems and major issues with authentication, client policies, cross domains, etc, etc..
So, I created my WCF service as a new website. tryied to browse to the service .svc file (webservice.svc for example) but I got an error 404, no https handler avaialble to process this request. Error details says: “The page you requested has a file name extension that is not recognized, and is not allowed.”
Looking in my handler mappings, I found out that there is no resource Dlls or managed code, to handle responses for *.svc request type. Normally you should have one of three *.svc mappings:
1- svc-Integrated handling *.svc – handler is System.ServiceModel.Activation.HttpHandler
2- svc-ISAPI-2.0-64 handling *.svc – handler this time is IsapiModule
3- svc-ISAPI-2.0 handling *.svc – handler is also IsapiModule.
If you dont have these handler mappings (although you normally should), make sure you add them manually. If you try to add them and can’t find any of the modules: IsapiModule or System.ServiceModel.Activation.HttpHandler, then go to Modules and make sure these two modules are enabled and avaialble.
This fixed my issue. But, you may have another problem:
– Make sure that in windows features, you have both WCF options under .Net framework are ticked. So go to Control Panel –> Programs and Features –> Turn Windows Features ON/Off –> Features –> Add Features –> .NET Framework X.X Features. Make sure that .Net framework says it is installed, and make sure that the WCF Activation node underneath it is selected (checkbox ticked) and both options under WCF Activation are also checked. These are:
* HTTP Activation
* Non-HTTP Activation
Both options need to be selected (checked box ticked).
– Make sure that the website is running as ASP .NET 2.0
– If you are still having problems, try Registering WCF From The Command Prompt . You can do this by running the following command from a command prompt (In Windows 7 you need to run command prompt as administrator – right click on shortcut and then click run as administrator).
To register WCF from the command prompt, use the following commands:
Navigate to WCF folder:
cd %SYSTEMROOT%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation
Where %SYSTEMROOT% is usually by default C:/Windows/
Then run this command:
ServiceModelReg.exe /i /x
Alternatively just run the following command:
%SYSTEMROOT%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe /i /x
– If this still doesn’t work, please try the steps listed in this blog post: http://bloggingabout.net/blogs/jpsmit/archive/2007/01/17/wcf-http-404-when-hosted-in-iis.aspx
I haven’t tried any of these steps before but some people found it useful.
All solutions are provided as is with no guarantees.
Please write a comment with any questions or experience you have with deploying WCF on IIS 7
Hope this helps.