WCF Service Method Not Allowed When Using WebsiteName

跟風遠走 提交于 2019-12-24 19:44:07

问题


I have the following service contract

[OperationContract]
        [WebInvoke(ResponseFormat = WebMessageFormat.Json, Method = "POST")]
        List<Myobject> GetAll();

When I call the service method using the IP of the server (An online server) it works, but when I call it using the name of the website it does not work, it returns "Method Not Allowed". The Url of the server is of format "https://www.example.com/myweb (This is not working) While for example xxxx.xx.xx.xx/myweb is working. Please note the these are not the same server, they are two different servers.

where https://www.example.com/myweb is redirected using an HttpProxy (NginX), to xxxx.xx.xx.xx/myweb


回答1:


The error was generated by NginX Adding this statement

# To allow POST on static pages
        error_page  405     =200 $uri;

to the nginX config file solved the error.

Check this link to have more info:

http://invalidlogic.com/2011/04/12/serving-static-content-via-post-from-nginx/



来源:https://stackoverflow.com/questions/48767539/wcf-service-method-not-allowed-when-using-websitename

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