【发布时间】:2011-07-10 16:39:32
【问题描述】:
我有 WCF 托管的 SOAP 服务,在发出 HTTP GET 请求时,我可以从浏览器和我的 SOAP 客户端正常访问该服务,但是,在执行任何 HTTP POST 请求时,响应是 404 Not Found。
我的 Web.config 看起来像:
<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" httpsGetEnabled="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" aspNetCompatibilityEnabled="true" />
<bindings>
<wsHttpBinding>
<binding>
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
<readerQuotas maxDepth="15" maxStringContentLength="524288" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</wsHttpBinding>
<basicHttpBinding>
<binding>
<readerQuotas maxDepth="15" maxStringContentLength="524288" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
我的服务在标记中使用 .svc 文件定义为:
<%@ ServiceHost Language="C#" Debug="true" Service="Boca.WebServices.Billing.QBService" CodeBehind="QBService.svc.cs" %>
同样,我可以使用浏览器和 SOAP 客户端访问我的服务,如下所示,使用 HTTP GET 但不能使用 HTTP POST:
我做错了什么?我是否应该不使用 .svc 标记而只在 Web.config 中定义我的服务?
更新:
当我在 VS 2010 中使用 IIS Express 在 localhost:8181 端口上“开始调试”我的 WCF 项目时,该服务的 HTTP POSTS 工作。只有当服务通过 IIS 托管时,服务的 HTTP POST 才会被拒绝或找不到。
【问题讨论】:
标签: wcf soap wcf-binding