WCF服务IIS主机错误(WCF Service IIS Hosting Error)

编程入门 行业动态 更新时间:2024-10-24 09:25:41
WCF服务IIS主机错误(WCF Service IIS Hosting Error)

我在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 ::通过服务器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>

产量没有太大变化。

i have a couple of web site in IIS now i have added a WCF service under sites>default website > MyWCFService.

When i tried to browse the Service1.svc file through content view in IIS i was presented below error

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.

Here is my webconfig file:

<?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>

The service runs fine in my local machine, but it fails in IIS, may be something to do with IIS Settings?

I'm running on IIS version 7.5.7600.

Thanks in advance

Edit 1: : Installed WCF Activation (HTTP Activation and Non-HTTP Activation) under .net Framework 3.5.1 features in via Server mnager. Now the error when i tried browing the service1.svc file through browser is

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>

No great change in output.

最满意答案

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

不要使用Content View,请使用浏览器。

另请参见IIS7.5上的静态文件处理程序不提供的脚本 。

The requested content appears to be script and will not be served by the static file handler.

Don't use Content View, use a browser.

See also Script not served by static file handler on IIS7.5.

更多推荐

本文发布于:2023-08-07 22:29:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1466424.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   主机   IIS   WCF   Hosting

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!