共用方式為


Common Setup Issues and Their Resolutions, When Publishing WCF Service to Local IIS

If you create a WCF Service Website hosted in local IIS, or you publish your WCF Service Application project to local IIS in your machine, you may encounter issues related to IIS setup that your service cannot be hosted in local IIS.

clip_image002

Here is an example as below: HTTP Error 500.21 – Internal Server Error Handler “svc-Integrated” has a bad module “ManagedPipelineHandler” in its module list.

clip_image004

In this article, I will list some common issues and their resolutions for your reference.                                          

1. Check whether your local IIS is installed properly and can run

I won’t discuss how to install local IIS here (You can search via bing according to your Windows version and IIS version), but tell how to validate whether your IIS is installed properly. You can input https://localhost in the IE browser. If you see the IIS default page as below, or see a similar page if your IIS has a different version, you will know you IIS is installed and running well.

clip_image006

2. Check whether your ASP.NET is registered and installed correctly

Sometimes, when you installed Visual Studio before installing IIS, it may cause ASP.NET registration issue in IIS and your service cannot be hosted in IIS. You can open Visual Studio Command Prompt tool (Start->All Programs->Visual Studio->Visual Studio Tools->Visual Studio Command Prompt. You need to open it as Administrator if your OS is Windows Vista or later version.), and run “aspnet_regiis.exe -i” or “aspnet_regiis.exe -ir”. You can try again after then and the issue should be fixed.

3. Check whether your Application Pool is configured correctly in IIS

Some issues may be caused by the mismatching between the target setting of your project/website and Application Pool configuration in IIS.

For example, we have a WCF service project targeting .NET4.0 and have trouble to host it in IIS.

Please find your website in IIS Manager, select it, and click “Basic Settings” located in the right panel. You will see the windows as below, which contains the info of the Application Pool you are using. You can see your application uses DefaultAppPool.

clip_image008

You need to further check the setting of DefaultAppPool. You can find the “Application Pools” node in the IIS Manager, choose the DefaultAppPool, and click “Basic Settings” located in the right panel. You will see the windows as below. Please double whether check the .NET Framework version is v4.0.xxxxx. If not, it doesn’t match with your 4.0 project. Please change it to the .NET4.0 version.

clip_image010

4. Check whether your WCF component is installed and registered correctly

Sometimes only WCF services cannot be hosted in IIS, while other ASP.NET services can. It may because WCF component isn’t installed and registered correctly in IIS. You can open Visual Studio Command Prompt tool (Start->All Programs->Visual Studio->Visual Studio Tools->Visual Studio Command Prompt. You need to open it as Administrator if your OS is Windows Vista or later version.), and run “ServiceModelReg.exe –ia”. You can try again after then and the issue should be fixed.

Comments

  • Anonymous
    May 31, 2010
    Works a treat thanks!

  • Anonymous
    June 22, 2011
    Hey thanx a ton , I had spent hour Googling , the Framework issue was with my Service.Thanks a lot man.

  • Anonymous
    January 23, 2014
    thanks a lot man. I am succeed after this article.

  • Anonymous
    July 29, 2014
    Heey, for me isn't works.. still show me the message "this page can't be displayed".. could you help me with this.??  thanks

  • Anonymous
    August 29, 2014
    Thank you!!! It's the best resolution with clear explanation and steps to follow!