WCF REST错误HTTP 307 [英] WCF REST error HTTP 307
问题描述
我有一个REST WCF服务。当POST尝试对这个服务做如下所述的操作时,我得到以下错误:
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();
错误:
HTTP 307
无操作监听 https://xx.xxx.xx.xxx/EnrollmentServer/Discovery.svc ,但有一个操作监听 https://xx.xxx。 xx.xxx/EnrollmentServer/Discovery.svc/ ,因此系统会将您重定向到此处。
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.
任何指针都会感激。
推荐答案
将UriTemplate更改为/。 RESTful WCF有一个事情关于希望Uris结束于/而不是结束。
Change your UriTemplate to "/" instead. RESTful WCF has a "thing" about wanting Uris ending with / instead of no ending.
此外,使用带有结尾斜杠的Uri,以避免WCF响应307。
Also, use the Uri with the ending slash to avoid WCF responding with the 307.
这篇关于WCF REST错误HTTP 307的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!