The page you are requesting cannot be served because of the extension configuration


Recently, I migrated to Windows 7 and ended up installing all my software’s again. I had a project which involved hosting a WCF service on IIS. The service used a .svc file extension and IIS 7 on my machine was not aware how to handle these files.

The error I got looked something like this:

HTTP Error 404.3 – Not Found

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map. Detailed Error InformationModule StaticFileModule.

There were more errors related to local machine below these errors.I looked up the net and after some digging figured out the solution to the problem:

  1. Run Visual Studio 2008 Command Prompt as “Administrator”.
  2. Navigate to C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation.
  3. Run this command servicemodelreg –i.

The servicemodelreg is a command line tool which provides the ability to manage the registration on ServiceModel on a machine. You can get more info on the tool at MSDN here.

I guess the mistake I made was enabling IIS post installing VS and .NET 3.5 or else the services are not turned on for IIS 7.0 by default.


Comments (50)

  1. Dave says:

    Thanks Rahul. This was very helpful and worked for me.

  2. Flea# says:

    Thanks Rahul; you saved me on this!

  3. Chaitanya says:

    Thanks a lot Rahul, this was absolutely spot on. Worked perfect for me.

  4. Jesus Christ says:

    Nicely done…thanks you saved my ass.

  5. Sanjeev says:

    I second all the comments. Very helpful indeed.

  6. Senthil says:

    Very very helpful. This should be added to the MSDN article on how to host a WCF service.

    http://msdn.microsoft.com/en-us/library/ms733766.aspx

  7. Patrick says:

    Great, thanks for sharing this with the community!

  8. fuulaluuf says:

    Note: this also applies to hosting Windows Azure WCF services on the local development fabric.

  9. Susheel says:

    Dude This tip helped me a lot Thanks

  10. Sandeep says:

    Thanks a ton! I came to the point of giving up hosting the Web service in IIS!

  11. Chris says:

    Thanks alot this helped my WCF hosting issue, I was also on the point of giving it up.

  12. Ashwin says:

    Thanks Rahul, you are a star. keep it up!!

  13. Folke says:

    Thank you!

    It must be that the services are not turned on by default.

    I started with a fresh machine and begun by installing IIS 7 and then the rest and I also got the problem!

  14. Darko Z says:

    Perfect, thats exactly what I did, installed all the software then realised i forgot to install IIS.

    Works perfectly, cheers!

  15. dev@rusmo.com says:

    Thanks  – I forgot that the order of installation was important.

  16. Andreas says:

    Nice! I installed VS 2008 prior to IIS too… But this did the trick!

  17. Prashant says:

    saved lot of time…. else it will take more time to explore new OS features and find out the solution..

    thanks buddy…. keep it up…

  18. JvD says:

    I am so happy I saw this. Thanks!

  19. Glenn says:

    Thank you, this did the trick for me as well!

  20. Chris says:

    Right on!  This helped me, too – I wonder though, since I have .net 4.0 installed, will that be problematic?

  21. Kafeel says:

    Thanks-buddy it was awesome. Worked instantly… Cool :)

  22. Prabhakar says:

    Thanks loot it works on the IIS 7 too

  23. Shruti says:

    Didn't work for me :( please explain the steps again

  24. Rahul Johri says:

    Shruti,

    Are yoiu still getting this error ? Please provide me more details around the error and your environment and I can try and help you.

  25. Alan says:

    Rahul, with .NET 4.0

    when run that command, it throws this error:

    [Error]Switch '-c' requires a component to be specified for installat

    stallation. Please specify which components to install or uninstall.

  26. Klas says:

    @Alan try running "aspnet_regiis.exe -i" in VS 2010 command prompt. That solved this issue for me.

  27. Hasan says:

    @Klas: Thanks a lot buddy.. it worked finally for me with your command run from version 4.0

    C:WindowsMicrosoft.NETFrameworkv4.0.30319>aspnet_regiis.exe -i

    Start installing ASP.NET (4.0.30319).

    …….

    Finished installing ASP.NET (4.0.30319).

  28. doll says:

    thanks. this was really very helpful.

  29. Dhaval says:

    Hey,

    Same thing can be done by going to server manager -> Features -> Add features -> .Net Framework 3.5 features and then checking the check box for the "WCF Activation" inside the ".Net Framework 3.5 features"

    And then next.

    Comleting this installation will fix these issue. Correct me if i am wrong?

    Thanks,

    Dhaval Shah

    kalashnikovtechnoblogs.blogspot.com

  30. Rahul says:

    Thats right Dhaval. The steps you mentioned will also yeild the same result.

  31. Vlad Bezden says:

    @Klas: Thanks a lot!!! in .NET 4.0 aspnet_regiis.exe -i did the trick

  32. mangojeans says:

    great

  33. Ranga says:

    Thank you so much it solves my problem.. !!!

  34. Durgesh Vasmatkar says:

    Thanks… worked for me perfectly !!!

    Thanks a lot for this post..

  35. Samir says:

    CamelCase: ServiceModelReg, otherwise it will not work

  36. cusman says:

    Exactly what I needed to get all the Handler Mappings configured for .cshtml (WebMatrix)

    For anyone else that needs more help on this

    Read about

    msdn.microsoft.com/…/k6h9cz8h%28v=VS.80%29.aspx

    Then use Command Prompt as Administrator

    cd C:WindowsMicrosoft.NetFrameworkv4.x

    aspnet_regiis.exe -i

  37. elmaulo says:

    thank for posting this great information

  38. Ami says:

    Thank you much man. I wish I had read your post 4 hours ago  which i wasted. :)

  39. prasad says:

    wowwwwwwwwwwwww……..i wasted 24 hours time to this…………..thanks alot dude

  40. Ankur Bansal says:

    Amazing… it worked… it took me 2 hours….. this works like a charmmm … Thanks alot

  41. sunneil says:

    Thanks…….Rahul………..it solved my problem…………..

  42. Vinayak says:

    Thank you very much Rahul… I am not a .Net guy… Was having a hard time to deploy a service locally…but I followed exactly what you have written… and BOOOOM!

  43. Ron says:

    This issue persists in VS2012. I suppose IIS team won't do VS team's job.

    Thank you for this.

  44. Paresh says:

    Thanks Rahul. its woked for me ..:)

  45. Desmond says:

    Thanks Rahul. You saved my valuable time. But now im getting this error

    Line 76:         <add binding="basicHttpsBinding" scheme="https" />

    Line 77:     </protocolMapping>    

    Line 78:     <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

    Line 79:   </system.serviceModel>

    Line 80:   <system.webServer>

  46. rahuljohri says:

    Desmond,

    Can you please let me know what is the scenario you are trying to achieve and I can try helping you.

  47. Nikola says:

    Thanks a lot.

    I tried to run dis command from run, but problem was that  have to run it as administrator.

  48. Vishesh says:

    Hey; thanks for solution… but sadly it didnt work for me.

    The App Pool on which I am running my site is .NetFrame work 4.0; and I followed the steps provided by you, and ran it on VS2010 dev cmd prompt; but of no help; its still showing the same error.

    Pls help

  49. Digvijay Singh says:

    Hi,

    I am also getting same error when I am trying to host the web service.

    Please guide me to solve this.

    Regards,

    Digvijay Singh