WCF 请求失败,HTTP 状态为 405:方法不允许 [英] WCF The request failed with HTTP status 405: Method Not Allowed
问题描述
我有一个 WCF 服务,该服务托管在 Windows 服务上,并使用 BasicHttp 端点为已连接到它的 Windows Mobile 设备提供服务.
I have a WCF service that has been hosted on a Windows Service and uses the BasicHttp endpoint to serve Windows Mobile devices that has been connected to it.
问题在于设备模拟器.我可以毫无问题地连接到该服务并使用它,但使用的是实际设备.我收到错误:
The problem is that with the Device Emulator. I can connect to the service and using it without any problems, but with an actual device. I receive the error:
WCF 请求失败,HTTP 状态为 405:方法不允许.
WCF The request failed with HTTP status 405: Method Not Allowed.
我使用以下代码来实现服务.
I have used following code to implement the service.
BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
basicHttpBinding.UseDefaultWebProxy = false;
m_ServiceHost.AddServiceEndpoint(typeof(IKooft), basicHttpBinding, "KooftService");
m_ServiceHost.Open();
我该如何解决这个问题?
How can I solve this problem?
推荐答案
检查您的 IIS 扩展名,尤其是 .wsdl 的扩展名是否有效:
Check your IIS extensions, particularly those for .wsdl are valid:
在 IIS 中:
- 查看您网站的属性.
- 在主目录选项卡中,单击配置.
- 点击添加(我的路径是"C:\Program Files (x86)\CommonFiles\MSSOAP\BINARIES\SOAPIS30.DLL")
- 将扩展名设置为 .WSDL 并允许获取"和发布"
- 选择脚本引擎"和验证该文件是否存在"
应该是这样.
这篇关于WCF 请求失败,HTTP 状态为 405:方法不允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!