2
我想將對象參數作爲json格式傳遞給wcf寧靜服務。wcf服務返回「方法不允許」錯誤
這樣的服務對話代碼;
[WebInvoke(
Method = "POST",
BodyStyle = WebMessageBodyStyle.Wrapped,
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
UriTemplate="PR")]
[OperationContract]
TWorkRequestPostResult PostRequest(TWorkRequestPostArgs args);
我的web.config文件這樣;
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule"/>
</modules>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
</system.webServer>
當我試圖與調用服務的 「http://本地主機/ serviceURL中/ PR」 的網址,服務返回 「不允許的方法」 錯誤消息。
感謝您的幫助,您的解決方案解決了我的問題。我用小提琴手。 – user1928388