2013-04-01 187 views
0

我对任何OperationContractPOST得到一个错误:405 method not allowed
GET工作就好了。我在本地和远程服务器上使用web服务器尝试过它,例如localhost/myPostMethod/myParamWCF ServiceRoute POST方法405不允许

我主持这样的服务:

RouteTable.Routes.Add(
     new ServiceRoute(@"Default", 
      new CustomWebServiceHostFactory(), 
      typeof(DefaultService))); 

(我使用的WebHttpBinding我CustomWebServiceHostFactory内)
不能我的远程服务器上更改IIS内的任何设置。我认为这不是必要的。似乎问题出在我的代码里面。

试过很多人认为,我现在有点绝望。对于任何建议都会很高兴。

回答

0

添加标题...解决。

<system.webServer> 
    <httpProtocol> 
     <customHeaders> 
     <add name="Access-Control-Allow-Methods" value="GET, POST" /> 
     </customHeaders> 
    </httpProtocol> 
    </system.webServer>