クライアント側で何かが発生したときにトリガーされるように、構成済みの URL エンドポイントを (wcf および POST メソッドを使用して) セットアップしました。リクエストのコンテンツタイプがapplication/jsonに設定されている場合はうまく機能しますが、クライアントが使用したいapplication/json+halに設定されている場合は機能しません。私の質問は、この問題にどのように対処し、何を変えなければならないかです。インターフェイスでの私のメソッドの定義は次のとおりです。
[WebInvoke(Method = "POST", UriTemplate = "/payload", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
string payload(requestpayload jsondata);
web.config
@carlosfigueira の提案を考慮して更新しました。
<services>
<service behaviorConfiguration="RestServiceBehavior" name="RestRaw.RestService">
<endpoint address="http://mywebsite.com/RestService.svc" binding="customBinding" bindingConfiguration="RawReceiveCapable" contract="RestRaw.IRestService" behaviorConfiguration="Web">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="RestServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="Web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="RawReceiveCapable">
<webMessageEncoding webContentTypeMapperType="RestRaw.JsonHalMapper, RestRaw" />
<httpTransport manualAddressing="true" />
</binding>
</customBinding>
しかし、私はこれを得ています:
500 System.ServiceModel.ServiceActivationException
何か考えてください