简体   繁体   English

PUT / POST在自托管WCF REST配置中不起作用

[英]PUT/POST not working in self-hosted WCF REST configuration

I have a self-hosted server (Windows service) that is supporting both SOAP/RPC (this may go away in the future) and REST. 我有一台自托管服务器(Windows服务),该服务器同时支持SOAP / RPC(将来可能会消失)和REST。 The RESTful GETs are working as expected, but PUT/POST are giving a 405 error (Method Not Supported). RESTful GET可以按预期工作,但是PUT / POST出现405错误(不支持方法)。 I'm pretty sure this is a configuration issue with my app.config, but I'm pretty new to this and am not sure what to try. 我很确定这是我的app.config的配置问题,但是我对此很陌生,不知道尝试什么。

Below is my config file. 下面是我的配置文件。 Any help would be greately appreciated... 任何帮助,将greately感激...

  <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>

I double-checked this using CURL and made a small change to my client. 我使用CURL仔细检查了一下,并对客户端做了一些小的更改。 This was straight User Error. 这是直接的用户错误。 :( :(

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM