不允许WCF ServiceRoute POST 405方法

时间:2013-04-01 11:00:35

标签: c# wcf

我在OperationContract POST 405 method not allowed的任何GET上收到错误 localhost/myPostMethod/myParam工作得很好。我已经在使用网络服务器的本地和远程服务器上尝试了它,例如 RouteTable.Routes.Add( new ServiceRoute(@"Default", new CustomWebServiceHostFactory(), typeof(DefaultService)));

我主持这样的服务:

{{1}}

(我在CustomWebServiceHostFactory中使用webHttpBinding)
无法更改远程服务器上IIS内的任何设置。我认为没有必要以太。似乎问题出现在我的代码中。

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

1 个答案:

答案 0 :(得分:0)

添加标题...已解决。

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