Rectangle 27 15

It's possible that your WCF service is returning HTML. In this case, you'll want to set up a binding on the service side to return XML instead. However, this is unlikely: if it is the case, let me know and I'll make an edit with more details.

The more likely reason is that your service is throwing an error, which is returning an HTML error page. You can take a look at this blog post if you want details.

tl;dr: There are a few possible configurations for error pages. If you're hosting on IIS, you'll want to remove the <httpErrors> section from the WCF service's web.config file. If not, please provide details of your service hosting scenario and I can come up with an edit to match them.

Having seen your edit, you can see the full error being returned. Apache can't tell which service you want to call, and is throwing an error for that reason. The service will work fine once you have the correct endpoint - you're pointed at the wrong location. I unfortunately can't tell from the information available what the right location is, but either your action (currently null!) or the URL is incorrect.

The WEb service is a customers I don't have access to this, other than the url I am given to consume

Hi, just edited my response having seen the stack trace you put in. Looks like you need to change your endpoint address.

Hi, I checked with fiddler the app is sending the same url, albeit without the ?wsdl on the end. I can post the code for the project if it helps

?wsdl is important - it means the browser is just getting "Web Services Description Language" for the service, and not calling the service. The WSDL, if you learn to read it, will tell you the action to send. Add that action to your client's endpoint address, and you should have more luck with the service.

Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).

c# - The content type application/xml;charset=utf-8 of the response me...

c# wcf wcf-binding
Rectangle 27 15

It's possible that your WCF service is returning HTML. In this case, you'll want to set up a binding on the service side to return XML instead. However, this is unlikely: if it is the case, let me know and I'll make an edit with more details.

The more likely reason is that your service is throwing an error, which is returning an HTML error page. You can take a look at this blog post if you want details.

tl;dr: There are a few possible configurations for error pages. If you're hosting on IIS, you'll want to remove the <httpErrors> section from the WCF service's web.config file. If not, please provide details of your service hosting scenario and I can come up with an edit to match them.

Having seen your edit, you can see the full error being returned. Apache can't tell which service you want to call, and is throwing an error for that reason. The service will work fine once you have the correct endpoint - you're pointed at the wrong location. I unfortunately can't tell from the information available what the right location is, but either your action (currently null!) or the URL is incorrect.

The WEb service is a customers I don't have access to this, other than the url I am given to consume

Hi, just edited my response having seen the stack trace you put in. Looks like you need to change your endpoint address.

Hi, I checked with fiddler the app is sending the same url, albeit without the ?wsdl on the end. I can post the code for the project if it helps

?wsdl is important - it means the browser is just getting "Web Services Description Language" for the service, and not calling the service. The WSDL, if you learn to read it, will tell you the action to send. Add that action to your client's endpoint address, and you should have more luck with the service.

c# - The content type application/xml;charset=utf-8 of the response me...

c# wcf wcf-binding
Rectangle 27 20

Try browsing to http://localhost/ScraperService.svc in the web browser on the server hosting the service, using the same Windows credentials that the client normally runs under.

I imagine that IIS is displaying an html error message of some description instead of returning xml as expected.

This also can occur when you have an http proxy server that performs internet filtering. My experience with ContentKeeper is that it intercepts any http/https traffic and blocks it as "Unmanaged Content" - all we get back is an html error message. To avoid this, you can add proxy server exception rules to Internet Explorer so that the proxy doesn't intercept traffic to your site:

That did the trick. I logged onto the server and tried to view the service and I received a DNS error. Turns out that sites were only visible internally so when my WCF client tried to access the service, it couldn't and returned an error. Thanks for your help!

I do not use proxy, but this answer inspired me to turn off in 'Automatically detect settings' in near previous proxy dialog, which helped

Browsing to it did the trick as it revealed a config error.

c# - WCF Service Client: The content type text/html; charset=utf-8 of ...

c# .net wcf web-services
Rectangle 27 14

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.

How could I go about testing this? Both the WCF Client and the WCF Service are running on the same IIS server just under different domains during testing...

Is the WCF client an ASP.NET application running under IIS? If so, this will probably be running as the Network Service account, which has minimum privileges. You will need to either allow this account access to the directory in IIS or configure the WCF client to run as a different windows account.

What if the WCF client is a client test tool like soapUI or WCFStorm?

c# - WCF Service Client: The content type text/html; charset=utf-8 of ...

c# .net wcf web-services
Rectangle 27 6

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.

c# - The content type application/xml;charset=utf-8 of the response me...

c# wcf wcf-binding
Rectangle 27 6

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.

c# - The content type application/xml;charset=utf-8 of the response me...

c# wcf wcf-binding
Rectangle 27 5

what's going on is that you're trying to access the service using wsHttpBind, which use secured encrypted messages by default (secured Messages). On other hand the netTcpBind uses Secured encrypted channels. (Secured Transport)... BUT basicHttpBind, doesn't require any security at all, and can access anonymous

<bindings>
    <wsHttpBinding>
     <binding name="wsbind"> 
         <security mode="Message">
             <transport clientCredentialType="Windows" proxyCredentialType="None" />
             <message clientCredentialType="Windows" negotiateServiceCredential="true"
                            algorithmSuite="Default" establishSecurityContext="true" />
         </security>
     </binding>
    </wsHttpBinding>
</bindings>
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsbind" name="wshttpbind" contract="WCFService.IService" >

c# - WCF Service Client: The content type text/html; charset=utf-8 of ...

c# .net wcf web-services
Rectangle 27 2

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).

My problem exactly. A million thanks for the solution :)

c# - The content type application/xml;charset=utf-8 of the response me...

c# wcf wcf-binding
Rectangle 27 2

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).

My problem exactly. A million thanks for the solution :)

c# - The content type application/xml;charset=utf-8 of the response me...

c# wcf wcf-binding
Rectangle 27 1

I tried all the suggestions above, but what worked in the end was changing the Application Pool managed pipeline from Integrated mode to Classic mode. It runs in its own application pool - but it was the first .NET 4.0 service - all other servicves are on .NET 2.0 using Integrated pipeline mode. Its just a standard WCF service using is https - but on Server 2008 (not R2) - using IIS 7 (not 7.5) .

c# - WCF Service Client: The content type text/html; charset=utf-8 of ...

c# .net wcf web-services
Rectangle 27 1

I had a similar situation, but the client config was using a basicHttpBinding. The issue turned out to be that the service was using SOAP 1.2 and you can't specify SOAP 1.2 in a basicHttpBinding. I modified the client config to use a customBinding instead and everything worked. Here are the details of my customBinding for reference. The service I was trying to consume was over HTTPS using UserNameOverTransport.

<customBinding>
    <binding name="myBindingNameHere" sendTimeout="00:03:00">
        <security authenticationMode="UserNameOverTransport" includeTimestamp="false">
            <secureConversationBootstrap />
        </security>
        <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
              messageVersion="Soap12" writeEncoding="utf-8">
            <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </textMessageEncoding>
        <httpsTransport manualAddressing="false" maxBufferPoolSize="4194304"
              maxReceivedMessageSize="4194304" allowCookies="false" authenticationScheme="Basic"
              bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
              keepAliveEnabled="true" maxBufferSize="4194304" proxyAuthenticationScheme="Anonymous"
              realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
              useDefaultWebProxy="true" requireClientCertificate="false" />
    </binding>
</customBinding>

where can I config username and password, it show "The username is not provided. Specify username in ClientCredentials."

c# - WCF Service Client: The content type text/html; charset=utf-8 of ...

c# .net wcf web-services
Rectangle 27 1

We use the Url Rewrite extension for IIS for redirecting all HTTP requests to HTTPS. When trying to call a service not using transport security on an http://... address, this is the error that appeared.

So it might be worth checking if you can hit both the http and https addresses of the service via a browser and that it doesn't auto forward you with a 303 status code.

c# - The content type application/xml;charset=utf-8 of the response me...

c# wcf wcf-binding
Rectangle 27 1

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

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

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.

i m getting text/html exception only for one function where i m reducing the size of the uploaded image using WebImage.

c# - The content type application/xml;charset=utf-8 of the response me...

c# wcf wcf-binding
Rectangle 27 1

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

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

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.

i m getting text/html exception only for one function where i m reducing the size of the uploaded image using WebImage.

c# - The content type application/xml;charset=utf-8 of the response me...

c# wcf wcf-binding
Rectangle 27 1

We use the Url Rewrite extension for IIS for redirecting all HTTP requests to HTTPS. When trying to call a service not using transport security on an http://... address, this is the error that appeared.

So it might be worth checking if you can hit both the http and https addresses of the service via a browser and that it doesn't auto forward you with a 303 status code.

c# - The content type application/xml;charset=utf-8 of the response me...

c# wcf wcf-binding
Rectangle 27 15

It's possible that your WCF service is returning HTML. In this case, you'll want to set up a binding on the service side to return XML instead. However, this is unlikely: if it is the case, let me know and I'll make an edit with more details.

The more likely reason is that your service is throwing an error, which is returning an HTML error page. You can take a look at this blog post if you want details.

tl;dr: There are a few possible configurations for error pages. If you're hosting on IIS, you'll want to remove the <httpErrors> section from the WCF service's web.config file. If not, please provide details of your service hosting scenario and I can come up with an edit to match them.

Having seen your edit, you can see the full error being returned. Apache can't tell which service you want to call, and is throwing an error for that reason. The service will work fine once you have the correct endpoint - you're pointed at the wrong location. I unfortunately can't tell from the information available what the right location is, but either your action (currently null!) or the URL is incorrect.

The WEb service is a customers I don't have access to this, other than the url I am given to consume

Hi, just edited my response having seen the stack trace you put in. Looks like you need to change your endpoint address.

Hi, I checked with fiddler the app is sending the same url, albeit without the ?wsdl on the end. I can post the code for the project if it helps

?wsdl is important - it means the browser is just getting "Web Services Description Language" for the service, and not calling the service. The WSDL, if you learn to read it, will tell you the action to send. Add that action to your client's endpoint address, and you should have more luck with the service.

c# - The content type application/xml;charset=utf-8 of the response me...

c# wcf wcf-binding
Rectangle 27 1

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.

c# - WCF Service Client: The content type text/html; charset=utf-8 of ...

c# .net wcf web-services
Rectangle 27 1

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

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

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.

c# - WCF Service Client: The content type text/html; charset=utf-8 of ...

c# .net wcf web-services
Rectangle 27 1

Even if you don't use network proxy, turning 'Automatically detect settings' in proxy dialog makes this exception go off.

c# - WCF Service Client: The content type text/html; charset=utf-8 of ...

c# .net wcf web-services
Rectangle 27 1

As with many, in my situation I was also getting this because of an error. And sadly I could just read the CSS of the html error page.

The source of my problem was also a rewrite rule on the server. It was rewriting http to https.

c# - WCF Service Client: The content type text/html; charset=utf-8 of ...

c# .net wcf web-services