WCF REST error HTTP 307

本秂侑毒 提交于 2019-12-19 03:36:36

问题


I have a REST WCF service. When a POST attempt is made to this service to an operation as mentioned below, I get the below error:

[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "", RequestFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)]
void Write();

Error: HTTP 307 There is no operation listening for https://xx.xxx.xx.xxx/EnrollmentServer/Discovery.svc, but there is an operation listening for https://xx.xxx.xx.xxx/EnrollmentServer/Discovery.svc/, so you are being redirected there.

Any pointers will be appreciated.


回答1:


Change your UriTemplate to "/" instead. RESTful WCF has a "thing" about wanting Uris ending with / instead of no ending.

Also, use the Uri with the ending slash to avoid WCF responding with the 307.



来源:https://stackoverflow.com/questions/14358178/wcf-rest-error-http-307

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!