错误方法不允许 [英] error Method not allowed
问题描述
嗨
以下是我的运营合同
hi
below is my Operation contract
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "SaveCardTemplateById")]
bool SaveCardTemplateById(CI.Data.DataModel.CardModel objCard);
inplementation
i得到错误,即方法不允许
\
为什么会出现这个错误
请帮帮我
after inplementation
i got an error i.e Method not allowed
\
why this error comes
please help me out
推荐答案
Refer - wcf服务返回方法不是al低错误 [ ^ ]。
Refer - wcf service returns "method not allowed" error[^].
您是否从浏览器调用服务?如果是这样,浏览器使用HTTP GET请求服务,而服务方法映射到HTTP POST, Method =POST
,从而导致错误方法不允许
。
Are you calling the service from the browser? If so, the browser requests the service using HTTP GET while the service method is mapped to HTTP POST, Method = "POST"
, thus resulting in the error "Method not allowed"
.
要修复,请更改为方法=GET
如果对REST有意义或尝试从支持POST的工具调用服务方法,例如 Fiddler 或 WcfTestClient
To fix, either change to Method = "GET"
if it makes sense with regards to REST or try calling the service method from a tool that supports POST, e.g. Fiddler or WcfTestClient
这篇关于错误方法不允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!