我在界面中使用以下代码并使用 webapi 服务。
[OperationContract]
[WebInvoke(Method = "GET")]
bool IsPaymentGatewayExitsForTenant(string tenantSlugName, string productCode);
我在本地运行并使用休息客户端测试服务
api/PaymentGatewayService/IsPaymentGatewayExitsForTenant?tenantSlugName=KPN&productCode=POSS
但是我收到以下错误在此处输入代码
{"Message":"The requested resource does not support http method 'GET'."} `enter code here`
如有任何帮助,我们将不胜感激。
最佳答案
能否请您使用“HttpGet
”属性装饰您的 Controller 类方法“IsPaymentGatewayExitsForTenant
”
[System.Web.Http.HttpGet]
bool IsPaymentGatewayExitsForTenant(string tenantSlugName, string productCode)
{
// your code goes here
}
希望这有效
关于asp.net-web-api - 405 错误 {"Message":"The requested resource does not support http method ' 获取'。"},我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19674928/