(405) 方法不允许。 WCF网络服务
(405) Method Not Allowed. WCF WebService
简介:
您好,我正在尝试在本地 IIS 7.5 服务器上设置 WCF Web 服务,但是在完成基本配置后,我无法使用 WinForms 测试客户端发送数据,它 returns标题中提到的错误。
我已经在这个问题上搜索过类似的线程,但我没有找到适合我的问题的任何内容。
数据:
-第三方提供的 Wcf WebService 和测试客户端
-他们已经在另一台服务器上工作,我正在使用相同的版本
-我可能在启用或配置 IIS 时做错了什么
要求:
-我需要知道我需要 enable/disable 哪些 IIS 功能才能正确安装它,以便我可以使用 Wcf WebService。(如果是这样的话)。
-如何正确配置服务器以解决上述错误。
我的配置:
-安装 IIS 后,我将 DefaulAppPool 更改为 .NET Framework v4.0.30.319;管道模式:集成。 -高级设置:加载用户配置文件 = False。
-使用 DefaultAppPool.Binding 创建了一个名为 "WcfMicrocontrollerService" 的新网站; Type:http, IP 地址: , 端口: 80
此时我可以通过 Web 浏览器访问它,但是当我使用测试客户端向服务 POST 数据时,我收到以下错误:"The remote server returned an unexpected response:(405) Method Not Allowed."
以下是Fiddler记录的发送数据包:
已发送:
POST http://192.168.0.102/MicroControllerComSvc.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/IMicroControllerComSvc/GetMicrocontrollerData"
Host: 192.168.0.102
Content-Length: 237
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><GetMicrocontrollerData xmlns="http://tempuri.org/"><microControllerData>1,1,1,1,2,2,1,0,100,300</microControllerData></GetMicrocontrollerData></s:Body></s:Envelope>
收到:
HTTP/1.1 405 Method Not Allowed
Cache-Control: private
Allow: GET, HEAD, OPTIONS, TRACE
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Tue, 01 Mar 2016 10:44:44 GMT
Content-Length: 5671
这里是 body:https://dl.dropboxusercontent.com/u/2237590/405.html
这似乎表明我应该查看处理程序映射,但我不知道在那里编辑什么。
好的,在对您的问题进行非常简短的搜索后,我发现了以下问题
WCF on IIS8; *.svc handler mapping doesn't work
忽略问题是关于 IIS 8 的事实,你是 运行 Windows 还是 Windows 服务器?
如果您正在使用 Windows,请转到...
- 控制面板 -> 程序 -> 程序和功能 > 打开或关闭 Windows 功能。在“.Net Framework 3.5(包括 .NET 2.0 和 3.0”部分
- 确保 "Windows Communication Foundation HTTP Activation" 已打开。
- 同时检查“.NET Framerwork 4.x 高级服务”和 "WCF Services" 检查以确保 HTTP 激活也已打开。
这是来自该问题的图片,显示了要进行的 .net 4.5 更改。
Features to turn on
如果您正在使用 Windows 服务器,请尝试按照有关如何使用服务器管理器设置角色的问题的第一个答案进行操作。
简介:
您好,我正在尝试在本地 IIS 7.5 服务器上设置 WCF Web 服务,但是在完成基本配置后,我无法使用 WinForms 测试客户端发送数据,它 returns标题中提到的错误。 我已经在这个问题上搜索过类似的线程,但我没有找到适合我的问题的任何内容。
数据:
-第三方提供的 Wcf WebService 和测试客户端
-他们已经在另一台服务器上工作,我正在使用相同的版本
-我可能在启用或配置 IIS 时做错了什么
要求:
-我需要知道我需要 enable/disable 哪些 IIS 功能才能正确安装它,以便我可以使用 Wcf WebService。(如果是这样的话)。
-如何正确配置服务器以解决上述错误。
我的配置:
-安装 IIS 后,我将 DefaulAppPool 更改为 .NET Framework v4.0.30.319;管道模式:集成。 -高级设置:加载用户配置文件 = False。
-使用 DefaultAppPool.Binding 创建了一个名为 "WcfMicrocontrollerService" 的新网站; Type:http, IP 地址: , 端口: 80
此时我可以通过 Web 浏览器访问它,但是当我使用测试客户端向服务 POST 数据时,我收到以下错误:"The remote server returned an unexpected response:(405) Method Not Allowed."
以下是Fiddler记录的发送数据包: 已发送:
POST http://192.168.0.102/MicroControllerComSvc.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/IMicroControllerComSvc/GetMicrocontrollerData"
Host: 192.168.0.102
Content-Length: 237
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><GetMicrocontrollerData xmlns="http://tempuri.org/"><microControllerData>1,1,1,1,2,2,1,0,100,300</microControllerData></GetMicrocontrollerData></s:Body></s:Envelope>
收到:
HTTP/1.1 405 Method Not Allowed
Cache-Control: private
Allow: GET, HEAD, OPTIONS, TRACE
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Tue, 01 Mar 2016 10:44:44 GMT
Content-Length: 5671
这里是 body:https://dl.dropboxusercontent.com/u/2237590/405.html
这似乎表明我应该查看处理程序映射,但我不知道在那里编辑什么。
好的,在对您的问题进行非常简短的搜索后,我发现了以下问题 WCF on IIS8; *.svc handler mapping doesn't work
忽略问题是关于 IIS 8 的事实,你是 运行 Windows 还是 Windows 服务器?
如果您正在使用 Windows,请转到...
- 控制面板 -> 程序 -> 程序和功能 > 打开或关闭 Windows 功能。在“.Net Framework 3.5(包括 .NET 2.0 和 3.0”部分
- 确保 "Windows Communication Foundation HTTP Activation" 已打开。
- 同时检查“.NET Framerwork 4.x 高级服务”和 "WCF Services" 检查以确保 HTTP 激活也已打开。
这是来自该问题的图片,显示了要进行的 .net 4.5 更改。 Features to turn on
如果您正在使用 Windows 服务器,请尝试按照有关如何使用服务器管理器设置角色的问题的第一个答案进行操作。