这是我创建的wcf restful服务。
[OperationContract]
[WebInvoke( Method="GET",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "GiveMenu")]
Stream GiveMenu();
[OperationContract]
[WebInvoke(Method = "POST",
BodyStyle = WebMessageBodyStyle.Wrapped,
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
UriTemplate = "GetOrder/{order_json}")]
bool GetOrder(string order_json);在这里,我可以像这样从GiveMenu方法中获取数据:
http://localhost:5203/Service1.svc/GiveMenu但是当我尝试像这样发布数据时:
http://localhost:5203/Service1.svc/GetOrder/{"order":[{"Tb_id":1,"Item_id":1,"Quantity":1,"Add_Details":"null"}]}然后我说:
HttpException (0x80004005) : A potentially dangerous Request.Path value was detected from the client (:).然后我在我的web配置文件中做了以下更正:
<httpRuntime targetFramework="4.5" requestPathInvalidCharacters=""/>然后我展示了不允许使用的方法,如下所示:

我应该怎么做才能让数据发布工作并解决这个错误。
发布于 2014-07-11 00:42:43
在这里回答:Getting "A potentially dangerous Request.Path value was detected from the client (&)"
您可以在web.config文件中尝试执行以下操作。
<system.web>
<httpRuntime requestPathInvalidCharacters="" requestValidationMode="2.0" />
<pages validateRequest="false" />
</system.web>https://stackoverflow.com/questions/23490850
复制相似问题