2013-10-30 163 views
2

我在我的界面中使用以下代碼並使用webapi服務。405 error {「Message」:「請求的資源不支持http方法'GET'。」}

[OperationContract] 
[WebInvoke(Method = "GET")] 
bool IsPaymentGatewayExitsForTenant(string tenantSlugName, string productCode); 

我在本地運行,並使用REST客戶端

api/PaymentGatewayService/IsPaymentGatewayExitsForTenant?tenantSlugName=KPN&productCode=POSS 

測試服務,但我得到以下errror enter code here

{"Message":"The requested resource does not support http method 'GET'."} `enter code here` 

任何幫助將appeciated。

+1

什麼是基類的控制器?請再展示一些代碼。 – Markus

+0

@markus ApiController – madhu

回答

5

能否請您裝點YOUT控制器類方法「IsPaymentGatewayExitsForTenant」與「HttpGet」屬性

[System.Web.Http.HttpGet] 
bool IsPaymentGatewayExitsForTenant(string tenantSlugName, string productCode) 
{ 
    // your code goes here 
} 

希望這個作品

+0

yes this works.thanks – madhu

+2

@madhu在StackOverflow上,如果有人提出了答案並且答案解決了您遇到的問題,請單擊建議答案左側的灰色複選標記。欲瞭解更多信息,請看這裏http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work。 –

相關問題