2013-10-30 189 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。 –

相关问题