PUT / POST无法在自托管WCF REST配置中工作

时间:2009-10-06 13:17:07

标签: wcf rest config put

我有一个自托管服务器(Windows服务),它支持SOAP / RPC(将来可能会消失)和REST。 RESTful GET正在按预期工作,但PUT / POST发出405错误(Method Not Supported)。我很确定这是我的app.config配置问题,但我对此很新,不知道该尝试什么。

以下是我的配置文件。任何帮助都将 grely 赞赏...

  <system.serviceModel>
    <!-- bindings -->
    <bindings>
      <basicHttpBinding>
        <binding name ="soapBinding">
          <security mode="None" />
        </binding>
      </basicHttpBinding>
      <webHttpBinding>
        <binding name="webBinding" />
      </webHttpBinding>
    </bindings>
    <!-- behaviors -->
    <behaviors>
      <endpointBehaviors>
        <!-- plain old XML -->
        <behavior name="poxBehavior">
          <webHttp/>
        </behavior>
        <!-- JSON -->
        <behavior name="jsonBehavior">
          <enableWebScript  />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="DSServerBehavior">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="True"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <!-- services -->
    <services>
      <service behaviorConfiguration="DSServerBehavior" name="dsServer.DSServer">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8000/DecisionSupportServer" />
          </baseAddresses>
        </host>
        <endpoint address="soap" 
                  binding="basicHttpBinding" 
                  bindingConfiguration="soapBinding" 
                  contract="dsServer.IDSServer" />
        <endpoint address="mex" 
                  binding="mexHttpBinding" 
                  contract="IMetadataExchange" />
        <endpoint address="rest"
                  binding="webHttpBinding"
                  bindingConfiguration="webBinding"
                  behaviorConfiguration="poxBehavior"
                  contract="dsServer.IDSServer" />
      </service>
    </services>
  </system.serviceModel>

1 个答案:

答案 0 :(得分:0)

我使用CURL对此进行了双重检查,并对我的客户进行了一些小改动。这是直接的用户错误。 :(