【发布时间】:2010-12-09 16:21:03
【问题描述】:
我有一个 .net CF 代理,它发出这样的 POST:
POST http://192.168.0.172:8080/MIS.WOService/Service.svc HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: http://tempuri.org/IWOService/LogIntoServer
Content-Length: 276
Connection: Keep-Alive
Expect: 100-continue
Host: 192.168.0.172:8080
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><LogIntoServer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/"><emp_pin>55555</emp_pin></LogIntoServer></s:Body></s:Envelope>
调用总是失败,服务器返回:
HTTP/1.1 404 Not Found
Date: Thu, 09 Dec 2010 16:07:14 GMT
Server: Microsoft-IIS/6.0
X-AspNet-Version: 4.0.30319
Cache-Control: private
Content-Length: 0
但是,如果在提琴手中我将 POST 更改为 GET,它可以工作...
我的网站配置允许在 svc 扩展上使用所有动词,并且未选中“验证文件存在”。
有谁知道 IIS 6 可能导致这种行为的原因是什么?
当我检查 IIS 日志时,它显示:
#Date: 2010-12-09 16:24:34
#Fields: date time s-sitename s-ip cs-method cs-uri-stem cs-uri-query s-port cs- username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status
2010-12-09 16:24:34 W3SVC1793831887 192.168.0.172 POST /MIS.WOService/Service.svc - 8080 - 192.168.200.67 - 404 0 0
2010-12-09 16:25:14 W3SVC1793831887 192.168.0.172 POST /MIS.WOService/Service.svc - 8080 - 192.168.200.67 - 404 0 0
2010-12-09 16:25:27 W3SVC1793831887 192.168.0.172 POST /MIS.WOService/Service.svc - 8080 - 192.168.200.67 - 404 0 0
2010-12-09 16:25:48 W3SVC1793831887 192.168.0.172 GET /MIS.WOService/Service.svc - 8080 - 192.168.200.67 - 200 0 0
2010-12-09 16:27:16 W3SVC1793831887 192.168.0.172 POST /MIS.WOService/Service.svc - 8080 - 192.168.200.67 - 404 0 0
显然我需要将名称作为 url :
http://192.168.0.172:8080/MIS.WOService/Service.svc/basic
然后服务器开始允许 svc 接收肥皂消息...
谢谢 格雷格
【问题讨论】:
-
您能否提供您如何在代码中定义 WCF 服务?