【发布时间】:2012-09-21 10:45:34
【问题描述】:
我有以下 WCF:
[OperationContract]
IList<OperationRoomDto> GetOperationRooms();
我有一个使用这个 WCF 的网站,当我使用 Visual Studio(Asp.Net 开发服务器)时它工作正常,但是当我将 WCF 部署到 IIS 时,我得到了这个异常:
远程服务器返回错误:(405) Method Not Allowed。
我创建了一个简单的网站来测试这个 WCF(在 IIS 上)并且它工作正常。
这是网站 web.config 文件的一部分:
<endpoint address="http://server/WcfService"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMessageService"
contract="MyProject.Web.Wcf.IMessageService" name="BasicHttpBinding_IMessageService">
</endpoint>
以及这部分网络服务配置文件:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
我尝试调试 w3wp.exe 服务以获取任何隐藏的异常,我在 web 服务方法处设置了一个断点,但调试器甚至没有到达那里,并且在到达 web 服务类之前发生了异常.
【问题讨论】:
-
我遇到了类似的问题,解决方案是来自 Windows 功能的turning on HTTP Activation。
-
当我遇到这个问题时,解决方案是turning on HTTP Activation。
标签: asp.net .net wcf iis-7 wcf-binding