【问题标题】:WCF Service IIS Hosting ErrorWCF 服务 IIS 托管错误
【发布时间】:2014-06-18 08:54:08
【问题描述】:

我在 IIS 中有几个网站,现在我在站点>默认网站> MyWCFService 下添加了一个 WCF 服务。

当我尝试通过 IIS 中的内容视图浏览 Service1.svc 文件时,出现以下错误

HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler. 

Detailed Error Information
Module:  StaticFileModule 
Notification : ExecuteRequestHandler 
Handler : StaticFile 
Error Code 0x80070032 
Requested URL :  https://localhost:443/MyWCFService/Service1.svc
Physical Path : D:\Inetpub\wwwroot\MyWCFService\Service1.svc 
Logon Method : Negotiate 
Logon User : XXXXXXXXXXXXXX

 Most likely causes:
•The request matched a wildcard mime map. The request is mapped to the static file handler. If there were different pre-conditions, the request will map to a different handler.

 Things you can try:
•If you want to serve this content as a static file, add an explicit MIME map.

这是我的 webconfig 文件:

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="MyService.Service1" behaviorConfiguration="MyService.Service1Behavior">
        <endpoint address="Service1" binding="basicHttpBinding" contract="MyService.IService1"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyService.Service1Behavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="webBehaviour">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

该服务在我的本地机器上运行良好,但在 IIS 中失败,可能与 IIS 设置有关?

我在 IIS 版本 7.5.7600 上运行。

提前致谢

编辑 1::通过 Server mnager 在 .net Framework 3.5.1 功能下安装 WCF 激活(HTTP 激活和非 HTTP 激活)。现在,当我尝试通过浏览器浏览 service1.svc 文件时出现的错误是

Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. 

i have added this entry in web.config file as well
<compilation debug="true" strict="false" explicit="true">
<assemblies>
<add assembly="System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</assemblies>
</compilation>

输出没有太大变化。

【问题讨论】:

    标签: wcf iis-7


    【解决方案1】:

    请求的内容似乎是脚本,不会由静态文件处理程序提供。

    不要使用内容视图,使用浏览器。

    另见Script not served by static file handler on IIS7.5

    【讨论】:

    • 试图在 Broswer 中打开 url。没有欢乐的伙伴。 500内部服务器错误。您要查找的资源有问题,无法显示。
    • 那个 URL 对我解决问题没有多大帮助。如前所述,我在 IIS 下还有其他几个网站,它们运行良好。所以它可能不是启用静态文件处理程序内容的问题
    • @Ramu“对我帮助不大”对我帮助不大,伙计。您需要提供更多信息,以便我们帮助您分析此问题。重复“它不起作用”我们无能为力。您收到的 500 Internal Server Error 的根本错误是什么?
    • 谢谢伙计,以下步骤解决了问题。 1. 在 IIS 中启用 WCF 选项(默认情况下未选中) 2. 执行 aspnet_regiis /iru 3. 从 web.config 中删除 dll 引用 4. 最后,我在 HTTPS 下部署我的网站,所以我创建了一个新网站在 IIS 中只有 HTTP 绑定的站点下。希望这可能对需要的人有所帮助。
    猜你喜欢
    • 2022-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-06
    • 2020-04-26
    • 1970-01-01
    相关资源
    最近更新 更多