• [ZT]使用IIS作为宿主的WCF服务出现HTTP Error 404.3 Not Found错误的解决办法


    原帖地址:http://www.cnblogs.com/xwendotnet/archive/2008/02/21/1075815.html

    错误页面如下,出现这个问题,很大的可能是在iis中没有正确的配置WCF服务,解决的办法也很简单
    使用 %Windows%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation目录下的ServiceModelReg.exe程序就好了

    首先检测服务状态:
    命令: ServiceModelReg -vi
    结果: 如果协议都是“未安装”状态 则可以确定是WCF在IIS中没有正确安装

    接着安装服务:
    命令: ServiceModelReg -i
    结果: 如果成功安装,会返回成功信息


    再试试服务,应该就可以正常使用了

    参考:http://blogs.msdn.com/davidwaddleton/archive/2007/11/02/wcf-and-404-3-errors.aspx

    应用程序“Default Web Site/WCF”中的服务器错误

    ---------我是分割线------

    After building, a WCF service in Windows Server 2003, I thought no big deal, for Windows Server 2008.  I deployed the service on my Windows Server 2008 machine and started getting 404.3 errors only with my WCF service.  After checking that I had all of the necessary dependencies:

    • 3.0 Framework
    • WCF Activation installed
      • This can be found under  the 3.0 framework options. Depending on your operating system this could be under different locations. 
        • Vista  : Control Panel -> Program and Features -> Turn on/ off Windows Features -> Microsoft.NET Framework 3.0
        • Server 2008 : Server Manager -> Add Features-> .Net Framework 3.0 Features -> WCF Activation

    I kept getting 404.3 errors, so I started examining IIS to make sure that the right stuff is registered.  After not finding anything wrong, I started looking at the WCF installation. I found that my WCF services where not installed.  You can do the installation manually by running "ServiceModelReg.exe", which was found at %Windows%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\.

    To check status run:
    Command: ServiceModelReg -vi
    Result: The expected result if "Default Installation" next to the features shown, otherwise the services are not active. 

    To turn on Services:
    Command: ServiceModelReg -i
    Result: Installation of WCF services in IIS 7(6)

    I was then able to immediately test my service and see that I could get to the WSDL.

    ---------我还是分割线------

    It sounds like you might not have ASP.NET 2.0 installed on the computer where you're trying to host the WCF service.  When you load a simple asp.net page, do you see its contents or does the page load as you expect?

     

    If the page does not load as you expect, you will want to install ASP.NET 2.0 on the system by doing the following:

    1. cd to %windir%\Microsoft.NET\Framework\v2.0.50727
    2. run aspnet_regiis -i -enable

    ASP.NET 2.0 should now be installed.  The next step is to reinstall WCF so it hooks into the ASP.NET and HTTP pipelines:

     

    1. cd to %windir%\Microsoft.NET\Framework\v3.0\Windows Communication Foundation
    2. run ServiceModelReg.exe -i -x

    The -i switch tells ServiceModelReg.exe to install WCF.  (The -r command you were running before was to reinstall WCF; it sounds like WCF may not have been properly installed previously.)

     

    The -x switch tells ServiceModelReg.exe to include the necessary custom action scripts.

     

    You can add the -y and -v switches if you'd prefer to supress confirmation (-y) or see verbose output (-v).

     

    Your system could have gotten into this state if you installed IIS on the system AFTER WCF was installed.  It could also happen if you had IIS on the system, but never enabled ASP.NET before installing WCF.

     

     

    ---------我依然分割线------

    IIS Hosted Service Fails

    NET Framework 3.5

    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.

     

    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)

  • 相关阅读:
    bootstraptreeview 拖拽
    剑指 Offer 40. 最小的k个数
    剑指 Offer 32 II. 从上到下打印二叉树 II
    剑指 Offer 30. 包含min函数的栈
    剑指 Offer 32 III. 从上到下打印二叉树 III
    剑指 Offer 39. 数组中出现次数超过一半的数字
    剑指 Offer 38. 字符串的排列
    剑指 Offer 35. 复杂链表的复制
    剑指 Offer 37. 序列化二叉树
    剑指 Offer 32 I. 从上到下打印二叉树
  • 原文地址:https://www.cnblogs.com/liangqihui/p/1864116.html
  • Copyright © 2020-2023  润新知