I trying to consume a WCF web service using stand alone application. I am able to view this service using Internet Explorer also able to view in Visual studio service refere
This could be an error in the web.config file.
Open up your URL in your browser, example:
http://localhost:61277/Email.svc
Check if you have a 500 Error.
HTTP Error 500.19 - Internal Server Error
Look for the error in these sections:
Config Error
Config File
When I ran into this error, I spent hours trying to find a solution.
My issue was that when I went to save the file I had accidentally hit the key stroke "G" in the web.config. I had a straggler Character just sittings outside, so the web.config did not know how to interpret the improperly formatted data.
Hope this helps.
Just in case...
If you are using SoapUI Mock Service (as the Server), calling it from a C# WCF:
WCF --> SoapUI MockService
And in this case you are getting the same error:
The content type text/html; charset=UTF-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8).
Edit your Mock Response at SoapUI and add a Header to it:
In my scenario, this fix the problem.
In WCF serive project this issue may be due to Reference of System.Web.Mvc.dll 's different version or may be any other DLL's different version issue. So this 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 -> That's works fine in my project and not have an Error.
I don't know the reason of this different version of DLL's issue but when I change the DLL's verison which is compatible with your WCF Project than it works fine.
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.
Try browse the WCF in IIS see if it's alive and works normally,
In my case it's because the physical path of the WCF is misdirected.
In my case it was simply an error in the web.config.
I had:
<endpoint address="http://localhost/WebService/WebOnlineService.asmx"
It should have been:
<endpoint address="http://localhost:10593/WebService/WebOnlineService.asmx"
The port number (:10593) was missing from the address.