C# IIS上的WCF主机引发异常(没有权限,HTTP错误404.3-未找到)
例外情况: 您没有查看此目录或页面的权限,因为 的访问控制列表(ACL)配置或加密设置 此资源位于Web服务器上 我第一次学习WCF,我正试图在IIS上托管它。我是一个完全的初学者,所以我可能会犯任何愚蠢的错误 从Visual Studio运行WCF:C# IIS上的WCF主机引发异常(没有权限,HTTP错误404.3-未找到),c#,.net,wcf,iis,C#,.net,Wcf,Iis,例外情况: 您没有查看此目录或页面的权限,因为 的访问控制列表(ACL)配置或加密设置 此资源位于Web服务器上 我第一次学习WCF,我正试图在IIS上托管它。我是一个完全的初学者,所以我可能会犯任何愚蠢的错误 从Visual Studio运行WCF: <?xml version="1.0"?> <configuration> <system.serviceModel> <behaviors> <serviceBehavio
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="mexBehavior" name="WSHttpService.WSHttpService">
<endpoint address="WSHttpService" binding="wsHttpBinding" contract="WSHttpService.IWSHttpService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>
我能够打开WSDL文档,并在本地运行时进行浏览
现在,当我在IIS管理器中将其添加为网站时,我得到了上面提到的异常
配置文件:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="mexBehavior" name="WSHttpService.WSHttpService">
<endpoint address="WSHttpService" binding="wsHttpBinding" contract="WSHttpService.IWSHttpService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>
微软以显示错误而闻名,这些错误完全是误导性的。请有人帮帮我,因为我可能犯了其他愚蠢的错误
解决方案我查看了一些需要检查的内容。
确保您的IIS用户帐户具有查看代码所在文件夹的权限
我会将绑定更改为基本http,直到您可以像预期的那样让IIS响应为止
此外,如果您在iis中的主机与iisExpress主机相比,“addbaseaddress=”http://localhost:8080“”将对IIS尝试为终结点提供服务的方式产生影响
我必须添加两个用户IUSR和IIS\u IUSRS
,并授予所有权限
在做了上述更改之后,我开始得到一个不同的异常
HTTP错误404.3-未找到
由于扩展名的原因,无法提供您请求的页面
配置如果页面是脚本,请添加处理程序。如果文件
应该下载,添加一个MIME映射。详细错误信息
解决方案:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="mexBehavior" name="WSHttpService.WSHttpService">
<endpoint address="WSHttpService" binding="wsHttpBinding" contract="WSHttpService.IWSHttpService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>
进入控制面板->Windows功能打开/关闭,然后在配置下面应用
basichttpcinding再次在localhost中工作,但在IIS上不工作。我已将所有权限授予所有用户。接下来,我将从配置中删除端口号,以查看是否允许IIS通过端口80进行响应。呸!我终于解决了这个问题。我已经添加了答案,以便其他人可以从中获得帮助。这是一个特别有帮助的新开发人员加入现有的wcf服务项目,他们的机器仍然处于新的状态。他们可能会面临这个问题。由于默认情况下,窗口操作系统不会在WCF服务复选框下包含上述选项。非常感谢。