[英]PUT/POST not working in self-hosted WCF REST configuration
我有一台自托管服務器(Windows服務),該服務器同時支持SOAP / RPC(將來可能會消失)和REST。 RESTful GET可以按預期工作,但是PUT / POST出現405錯誤(不支持方法)。 我很確定這是我的app.config的配置問題,但是我對此很陌生,不知道嘗試什么。
下面是我的配置文件。 任何幫助,將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>
我使用CURL仔細檢查了一下,並對客戶端做了一些小的更改。 這是直接的用戶錯誤。 :(
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.