Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF REST error HTTP 307

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.

like image 669
Thomas Avatar asked Jan 14 '23 12:01

Thomas


1 Answers

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.

like image 121
Jeff Fischer Avatar answered Jan 22 '23 00:01

Jeff Fischer