Monday, September 3, 2012

WCF on IIS and Windows 8

Just spend some time getting a simple WCF service up and running under IIS on my Windows 8 machine. Apparently, if you install IIS after installing the last .NET framework (ie. installing Visual Studio 2012), not all necessary handlers, adapters and protocols for WCF are installed on your IIS.

First time I tried to reach the WCF service it gave me an error that said 'The page you are requesting cannot be served because of the extension configuration.' This means you need to run Servicemodelreg.exe to reregister WCF (same kind of registration you needed from time to time for ASP .NET on previous versions of IIS, remember aspnet_regiis). You can find this tool at C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation for version 3.0 or at C:\Windows\Microsoft.NET\Framework\v4.0.30319 for version 4.0.

Now looking at the MSDN site, they will tell you to run the 3.0 version. After doing so, however, you won't have the necessary handlers installed for a WCF service created with Visual Studio 2012, since they are all version 4.0. So that won't work.

Running the 4.0 version however won't work either. If you try Servicemodelreg.exe -i it will tell you to register with the -c option (register a component). If you try the -i -c option you will get the error (and the solution!) that this tool cannot be used on this version of windows. What you can use, though, is the 'Turn Windows Features On/Off' dialog.

So simply open this up from your control panel (I pinned my control panel to my start page on day one of installing Windows 8, otherwise I wouldn't be able to find it again) and check the necessary WCF features you want to have available on your WCF. In most cases, just flagging HTTP will do. You can find the WCF features under .NET Framework 4.5 Advanced Services.

And that's what you need to get yuor WCF service running under IIS on Windows 8. Hope this was helpful.

Addendum: This fix recently also solved the issue of a 'HTTP Error 400. The request hostname is invalid' error of a colleague when trying to run a WCF service on Windows 8.


  1. I spent the last 3 hours trying to get a site working on my local machine that uses .svc mapped to wcf in windows 8. I ran into all the problems you pointed out, and didn't find the WCF options in the Windows Features section until I found this post. Thanks for helping solve this problem!

    Chris May /

  2. Thank you very much...

    I do not understand why my WCF + framework 4.0 Need 4.5 WCF HTTP service enable..

    But it´s work..

    Sorry about poor English...

  3. I am very happy to read your post and I would like to take more important information like this Windows 8 News, Apps, Tips, etc. Windows 8 Post. To know more please click bellow link.

    Windows 8 post

  4. Thank you so much for this post! I especially appreciated the screenshot showing exactly which options to check/install to get my WCF service working! You saved me so much time not having to troubleshoot this myself!

    Thank you!

  5. I just got Windows 8 installed and I was facing this issue with WCF service.
    The description which you gave was crystal clear and fixed my issue in less than 5 mins.

    Thanks a ton

  6. Many thanks for this brilliant post! Many points have extremely useful. Hopefully you'll continue sharing your knowledge around. startup programs

  7. Thanks a lot! You've saved my time )

  8. Thank you!! I am glad that i found this post. I didnt expend that much time trying to figuring out. now, i know Sitefinity will tell you all features that you need to have on in windows 2012/IIS 8.