0
我已经创建了WCF休息服务。在localhost GET和POST请求都正常工作。但是当我将它部署在服务器中时,只有GET请求正在工作。当我尝试调用POST请求时,它以“405方法不允许”响应。方法不允许在服务器WCF POST
在我的web.config
<service name="RestService.Agreement" behaviorConfiguration="ServiceBehaviour">
<endpoint address="" binding="webHttpBinding"
contract="RestService.IAgreement" behaviorConfiguration="web">
</endpoint>
</service>
// -------------------------------- --------------
<behaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
响应头的POST,
Access-Control-Allow-Headers → Content-Type, Authorization, X-Requested-With
Access-Control-Allow-Methods → GET, PUT, POST, DELETE, OPTIONS
Access-Control-Allow-Origin → *
Allow → POST
Connection → keep-alive
Content-Length → 1565
Content-Type → text/html; charset=UTF-8
Date → Mon, 14 Sep 2015 04:59:54 GMT
Server → Microsoft-IIS/8.5
X-Powered-By → ASP.NET
这不适合我的情况.... –