WCF Service Client: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding

后端 未结 19 2245
情书的邮戳
情书的邮戳 2020-11-27 18:30

I\'ve got a WCF Service running on my local IIS server. I\'ve added it as a service reference to a C# Website Project and it adds fine and generates the proxy classes automa

相关标签:
19条回答
  • 2020-11-27 18:36

    In my case a URL rewrite rule was messing with my service name, it was rewritten as lowercase and I was getting this error.

    Make sure you don't lowercase WCF service calls.

    0 讨论(0)
  • 2020-11-27 18:39

    An HTML response from the web server normally indicates that an error page has been served instead of the response from the WCF service. My first suggestion would be to check that the user you're running the WCF client under has access to the resource.

    0 讨论(0)
  • 2020-11-27 18:39

    In my WCF serive project this issue is due to Reference of System.Web.Mvc.dll 's different version. So it may be compatibility issue of DLL's different version

    When I use

    System.Web.Mvc.dll version 5.2.2.0 -> it thorows the Error The content type text/html; charset=utf-8 of the response message

    but when I use System.Web.Mvc.dll version 4.0.0.0 or lower -> it works fine.

    I don't know the reason of different version DLL's issue but by changing the DLL's verison it works for me.

    This Error even generate when you add reference of other Project in your WCF Project and this reference project has different version of System.Web.Mvc DLL or could be any other DLL.

    0 讨论(0)
  • 2020-11-27 18:41

    For me, it was the web app connection string pointing to the wrong database server.

    0 讨论(0)
  • 2020-11-27 18:43

    You may want to examine the configuration for your service and make sure that everything is ok. You can navigate to web service via the browser to see if the schema will be rendered on the browser.

    You may also want to examine the credentials used to call the service.

    0 讨论(0)
  • 2020-11-27 18:43

    X++ binding = endPoint.get_Binding(); binding.set_UseDefaultWebProxy(false);

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