19 out of 29 rated this helpful - Rate this topic

IIS Hosted Service Fails

If an IIS hosted service fails you may see any of the following symptoms:

  • When browsing to a .svc file, the file is not recognized, the browser shows a blank page, or the text of the file is displayed instead of the service's help page as in the following example.

    <%@ServiceHost language=c# Debug="true" Service="Microsoft.ServiceModel.Samples.CalculatorService" %>
    
  • When attempting to access a Web-hosted service, you may encounter the following exception.

    Unhandled Exception: System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (405) Method not allowed.
    
    This typically occurs if ASP.NET is not installed or the .svc file type is not mapped to the aspnet_isapi.dll.

    To correct this you must make sure that aspnet_isapi is enabled as a Web service extension for IIS. You can view and modify this setting using IIS Manager, or by running aspnet_regiis –i –enable from the .NET Framework installation directory. Once you have done so, verify that ASP.NET is running. To do so, place a test .aspx file in the \inetpub\wwwroot directory, and make sure it can be browsed with a browser.

  • If you installed IIS after Windows Communication Foundation (WCF) was installed you must run the following command.

    "%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r
    
    This registers the required script maps in IIS.

    You must also make sure that the .svc file type is mapped to aspnet_isapi.dll.

To verify that the svc file type is mapped to be handled by aspnet_isapi.dll in IIS 5.1 or 6.0
  1. From the Start menu, right-click Computer, then click Manage.

  2. Expand Services and Applications, Internet Information Services.

  3. Right-click Web Sites and select Properties.

  4. On the Home Directory tab, click Configuration.

  5. In the list of application mappings, verify that the .svc file is mapped to the aspnet_isapi.dll. If the file has not been mapped:

    1. Click Add.

    2. In the Add/Edit Application Extension Mapping dialog box, click Browse.

    3. Browse to the folder that contains the aspnet_isapi.dll, select the file, then click Open.

    4. Specify .svc as the extension.

    5. Make sure Check that file exists is unchecked.

    6. Click OK, and OK again to return to the Web Sites Properties dialog box.

      ms752252.Warning(en-us,VS.90).gif Caution:
      If the OK button is disabled, select the textbox where the selected filename is displayed and the OK button will be enabled.

  6. Click OK to close the dialog box.

To verify that the svc file type is mapped correctly in IIS 7.0
  1. Open a command prompt window and type start inetmgr to open the Internet Information Services (IIS) MMC snap-in.

  2. In the left pane, expand the node with the computer's name, then expand the Web Sites node, and then select the Default Web Site.

  3. Double-click Handler mappings in the Features View.

  4. In the list of application mappings, verify that the .svc file is mapped to the aspnet_isapi.dll. If the file has not been mapped:

    1. Click Add Managed Handler.

    2. Type *.svc into the Request path:.

    3. Type System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 into the Type textbox.

    4. Type svc-Integrated into the Name: textbox.

    5. Click OK.

    6. Click Add Script Map.

    7. Type *.svc into the Request path:.

    8. Type %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll into the Executable: text box.

    9. Type svc-ISAPI-2.0 into the Name: text box.

    10. Using the Move Up/Move Down controls, ensure that the managed handler (svc-Integrated) appears before the aspnet_isapi (svc-ISAPI-2.0) handler in the list.

    11. Click OK.

See Also

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
If you cannot find Move Up/Down Control in IIS 7 Control Panel
$0Under the right "Actions" Panel, select "View Ordered List" then Using the Move Up/Move Down controls, ensure that the managed handler (svc-Integrated) appears before the aspnet_isapi (svc-ISAPI-2.0) handler in the list.$0 $0$0 $0
Solution: Revert to Parent
I use VS2005, VS2008, VS2010, PHP, ColdFusion, etc. on Windows 7 SP1. For some reason, the .NET 3.0 or 4.0 Handler Mappings were not listed on my IIS Web Sites (including the Default Web Site) but they were listed on any new Web Sites that I created. I tried various combinations of aspnet_regiis.exe, ServiceModelReg.exe, uninstall/reinstall of .NET, and so on but none of them worked. What finally worked was simply this:

Launch IIS Manager, select the Default Web Site (or other web site having this problem), open Handler Mappings, click Revert to Parent.

Before doing this, you may want to examine the Entry Type column of the Handler Mappings view to see if there are any that are not Inherited, since those might be related to the product that disconnected inheritance in the first place. One thing that can disconnect the inheritance is changing the order of the handlers.
Do you need to run both 64-bit and 32-bit?

Does anyone know if you have to do both Framework and Framework64, or is one sufficient?



"%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r"%WINDIR%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r

"%WINDIR%\Microsoft.Net\Framework64\v3.0\Windows Communication Foundation\ServiceModelReg.exe" -r

IIS 5.1 fails to serve .svc files after installing 3.5 Framework / Visual Studio 2008.
The .svc extension inside iis server for the Default Website gets corrupted/ Missing after installing 3.5 framework or Visual studio 2008. This prevents IIS from serving .svc files. You can add the .svc extension inside Default Website properties. Default Website - HomeDirectory - Configuration. Add the following extension:


Executable: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll

Extension: .svc

Verbs: Limit to option: GET,HEAD,POST,DEBUG

Please type the verb to get the OK button.

Restart IIS to see .svc files getting served.

I have taken this and simplified it from Martin Vollmer's blog.

you can also go to: http://blogs.msdn.com/martinv/archive/2006/09/11/749388.aspx for the original version.


(Edited by Luke Puplett; removed gt/lt symbols causing HTML bold markup to corrupt this page)

IIS 7.5 serves error when browsing to .svc or WSDL
servicemodelreg -i fixes error when browsing to an .svc file or its WSDL.

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

Credit to Rahul Johri in Hyderabad.
You need to do this for every virtual directory...

I had the same problem outlined above, i.e. svc files just showing their literal contents when opened in a browser. I eventually managed to solve the problem after I realised that the steps mentioned above for the Web Sites node (Right-click Web Sites and select Properties...) then needs to be repeated for any virtual directories you want to configure. You need to make sure the .svc mapping is there globally and for each specific virtual directory.

OK button in Application Mapping dialog is disabled.

Step 5c is incomplete. IIS 5.1 also requires you to click on the filename after selecting it and before you click OK (the OK button will be disabled until you click on the filename in the textbox).

Source: http://forums.devarticles.com/web-server-configuration-51/iis-problem-unable-to-add-application-extension-mapping-2527.html

(Conclusion: Microsoft have NEVER tested this process under IIS 5.1)

Also, the current location of the DLL is: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll

This may change with post 3.5 framework but I'm sure you can find it from there. I don't know why Microsoft withheld the locaiton of the file. They decide where to put it and don't inform the user during installation.

Also, just for completeness but I'm sure most of you will know this, the Computer Management facility (in XP) is accessed via 'My Computer' (in the Desktop folder), not from the Control Panel as indicated by this article.

Wow this link is a God's hand written text

Believe me this solved my problem I was struggling with since 3 and a half weeks, yelling, crying and writting all sort of messages with images on Silverlight forum about WCF Service not working outside VS 2008 Please, make it as an automated process in the installation of VS2008 and/or Silverlight SDK or whatever because small people like me do not know those technical settings.

ServiceModelReg Parameter
You write, if using Vista, one shold use "-L" parameter for ServiceModelReg.exe. If using ServiceModelReg I am informed that there is no "-L" parameter (by the way, the parameter-description is shown in german on my german system). If using -l parameter I get an error "unknown option: L".