The remote server returned an unexpected response: (400) Bad Request. wcf

后端 未结 1 869
渐次进展
渐次进展 2021-01-27 10:00

i have one web project that uses wcf web services and it\'s not works fine.

here i include web config file for more understand :

    

        
相关标签:
1条回答
  • 2021-01-27 10:41

    We are supposed to add [WebGet]/[WebInvoke] to the auto-generated operation of the interface so that it maintains consistency of binding between server and client. It located in the auto-generated client proxy class.
    We consume the WCF service by adding service reference, there is a difference when the service is created with WebHttpBinding. This type of service is typically called Restful style service, we could call it directly by inputting the service address in the browser.
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-create-a-basic-wcf-web-http-service
    So if we want to consume the service by using a client proxy class, we need to maintain the consistency of binding between the server and client, just like the WCF SOAP service.
    Feel free to contact me if the problem still exists.

    0 讨论(0)
提交回复
热议问题