當我嘗試從瀏覽器中點擊URL時,我新創建了一個WCF並且m面臨400錯誤請求錯誤。在GET/POST方法中給出400錯誤請求的WCF方法
我的服務合同看起來像
[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "GetUsers")]
string GetUsers();
我已在webconfig的條目
<serviceMetadata httpGetEnabled="true"/>
網址我打了瀏覽器
http://localhost:51561/AceWebService.svc/GetUsers
這裏是部分webconfig:
<system.serviceModel>
<services>
<service name="AceWebService.AceWebService" behaviorConfiguration="AceWebService.AceWebServiceBehavior">
<!-- Service Endpoints -->
<endpoint address="" binding="wsHttpBinding" contract="AceWebService.IAceWebService">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="AceWebService.AceWebServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above 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>
</system.serviceModel>
已經提到所有問題在這裏stackoverflow ..沒有得到任何幫助..請建議的變化。
thnx
不適合我 – 1Mayur 2012-03-15 10:50:30
我想知道我上面的代碼有什麼問題.. dnt想要替代 – 1Mayur 2012-03-15 11:37:06
我想說你的web服務調用是正確的,必須是配置 – reach4thelasers 2012-03-15 11:44:35