Problems with Deploying WCF services on IIS 7.0 (or IIS 6, IIS) and other deployment options and scenarios (visual studio .NET and Windows Activation Services)

There are 3 main ways to deploy Windows Communication Foundation – WCF services to consume:

1- IIS
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:

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:

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.


Problem Running WCF on Visual Studio 2008 and Windows 7 – could not find host – page timeout

This post is about a problem that I have had recently with visual studio .Net 2008, WCF and Windows 7.

I have a working WCF service (add to the solution by another person) which I am trying to run from within my visual studio 2008. Normally, you should go to your project, right click on it and click on add service reference. You should then search for services within the solution and add the WCF service which is in the same solution. This will even work if it is in a different solution as long as the WCF service is in a Visual Studio solution that is currently open.

When I try to search for this service and add it, I got timeout error, error downloading service information and if I try to run the service itself by navigating to it from Visual studio, the wcfservice.svc file itself does not open. It comes out with could not find host, page cannot be displayed and timeout errors.

After spending sometime trying to find out what is causing it, I found out that I have miraculously forgot to run Visual studio 2008 as Administrator. Basically, when you want to run visual studio 2008, you need to right click on its shortcut icon (in the task bar in windows 7) and click on Run As Administrator. This way, you will be running Visual studio as an administrator. Even if you are an administrator on the machine, you will not be running visual studio as admin if you just click on it to open.

I know this issue sounds simple and not a lot of people will have that but, I believe the post might be helpful to someone. I can’t recall having this problem on Windows server 2003, windows server 2008, windows vista or even winsows XP! It’s only happening on this development machine which was built for me using Windows 7.

If you want to stop having to right click on the shortcut icon and click on run as administrator everytime, there is a simple way to make an application to run as administrator by default permanently. Go to visual studio .net shortcut on the start menu (or the other application that you want it to always run as administrator), right click on the visual studio application icon, and click on properties. In the application properties, click on compatibility tab and then check the privilege level option that says “Run this program as administrator”.

This should get you to always run visual studio or any other application always as an administrator.

Please comment if you found this post useful.

Introduction and Notes about WCF, Silverlight and Creating a Silverlight application that consumes – invokes a WCF service via async (asynchronous) web service call

This post is an introduction and a collection of some useful information, notes and facts about WCF in genreal, Silverlight and running a silverlight web application that uses a WCF service via asynchronous web service call.

– The first fact that you need to know is that:

The only option for web service calling in Silverlight is asynchronous and Silverlight framework does not provide any API for synchronous call. Saying that, there are few work arounds for synchronous web service calls from silverlight to a WCF service. Personally, I haven’t tried or need to use any of these. If you are interested, you can look at one of these posts:
– The greatest advantage of calling methods asynchronously is because it enables the application to continue doing useful work while the method call runs. If there is any delay from the WCF service in sending back the required data, Async calls ensures that your client application is not hanging there freezing and doing nothing until the Windows Communication Foundation (WCF) services returns the requried data. WCF and clients can participate in asynchronous operation calls at two distinct and different levels of the application. This makes WCF applications flexibile to maximize throughput balanced against interactivity.

– Visual Studio .NET 2008 gives you two project templates to create a WCF project:
 1- “WCF Service Application” and
 2- “WCF Service Library.”

WCF Service Application is the conventional web service application similar to ASP.NET web service but in this case built on Windows Communication Foudnation technology.

WCF Service Library project is different. The output of this project is a compiled dll file(s) along with a dll.config configuration file. The produced output can then be added to a client service application or project, deployed as a separated secure web service or as part of a larger hosted web service.

– When creating a WCF service for a silverlight application, you can simply add the WCF service to the test Web project which is added by default by Visual Studio when you create a new Silverlight 3 project. You can do this by right clicking on the silverlight web project (test project usually called .Web) and then click on add new item. In the new item window, always choose in this case silverlight enabled WCF service as this adds one line to your web.config. On the other hand, you can add the WCF service as another project to the same solution or even a separate solution which is the more practical approach as normally the web service is separate and hosted independantly from its client(s).

– If the WCF client application is not silverlight, opt to use the asynchronous approach in your operation implementation especially in the case when the service implementation makes a blocking call, such as doing Input/Output IO work.

Generally, even if you have a choice to choose between a synchronous and asynchronous call, always try to opt for the asynchronous one.

MSDN (and Microsoft) specifies the essential cases that you need to use Asynchornous calls to WCF as follows:

* If it is a silverlight application (the only option you have really!).

* If you are invoking operations from a middle-tier application.

* If you are invoking operations within an ASP.NET page, use asynchronous pages.

*- If you are invoking operations from any application that is single threaded, such as Windows Forms or Windows Presentation Foundation (WPF).

In all these cases, always try to opt to Async calls rather than synchronous if this is an option.
– WCF is Microsoft’s attempt of unifying web and distributed services. WCF services can work with a variety of client applications including php, ruby, etc. and any client that can use basicHTTP binding.

– WCF is regarded as the successor to conventional Microsoft web services and communication technologies such as: DDL, DCOM, Remoting, Web Services, WSE, etc.. This is especially because WCF is built with the aim to provide “SOA” or Service Oriented Architecture for distributed applications.

– WCF can have messages sent in a variety of channels including HTTP, TCP, MSMQ, Named pipe, etc.

– WCF runtime resides under the System.ServiceModel namespace.

– In most cases WCF has a much better and faster performance ranging between 25%-50% in some cases. Refer to this MSDN article for some comparisons:

– The throughput of WCF is inherently scalable from a single processor to a quad processor.

– The WCF model unifies the feature wealth of ASMX, WSE, Enterprise Services, MSMQ, and Remoting. This way, developers only have to master a single programming model.

– WCF can be hosted in IIS Servers, Windows services and standalone apps like windows forms, console apps.

– WCF provides a DataContractSerializer which allows complex data types and private attributes to be serialized and sent. Being Serializable means, the object can be hydrated, dehydradted from a stream/bunch of bytes, into a living class instance.