WCF Service returns 400 Bad Request

后端 未结 3 939
感动是毒
感动是毒 2021-01-19 20:25

I\'ve got this application that works locally and when deployed and using a .mdf SQL Express database file (which I usually use for testing purposes). However, when I change

3条回答
  •  甜味超标
    2021-01-19 21:10

    This could be that you are making a POST but the service is expecting a GET.

    Try specifying that the method should be a POST:

    [WebInvoke(Method = "POST", UriTemplate = "", ResponseFormat = WebMessageFormat.Json)]
    

    The other this that it could be is that you are using a trusted connection. This means that the security context is the identity of the application pool (if defaults are used). Then you will be making a connection to the database using a local account that does not have access on a database on a different machine.

    The strange thing is that based on the error message it should be the first explaination, but based on your description it would be the second.

提交回复
热议问题