Client found response content type of 'text/html', but expected 'application/soap+xml'.

Topics: General Discussion Forum, July and December Releases Forum
Feb 20, 2008 at 8:11 AM
This is the code in button click, i have added a web service reference by pasting the url in the add service reference dialog box. i could see the methods inside the service, hence i add the reference.

protected void Button1_Click(object sender, EventArgs e)
HelloWorldService service = new HelloWorldService();
CredentialCache cache = new CredentialCache();

cache.Add(new Uri(service.Url), "Negotiate", new NetworkCredential("subin", "erty@"));
service.Credentials = cache;
service.PreAuthenticate = true;


while runnig the application i am receving the error like this:

Client found response content type of 'text/html', but expected 'application/soap+xml'.

can anybody help me regarding this issue..

Feb 20, 2008 at 11:01 AM
A couple of suggestions.
  1. Not sure why you need to use additional credentials unless you have Windows Integratd "only" set in IIS
  2. That error is because your service is returning an HTTP page with the error description (likely because there is some problem with the credentials in this case handled by IIS).

Try using simple Anonymous+Integrated or just anon.
Feb 22, 2008 at 2:35 AM
Edited Feb 22, 2008 at 4:22 AM
I hosted the webservice in another machine's IIS. While specifiyng the address in the iE address bar, i am able to see the service.

I have checked both the check boxes,
then i am receivinf the error like...

The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.

Now i am using WCSF to create my application.
Here on right click, i am not getting add service reference,
when i tried to create config file using svcuitl, i am not able to execute that. its showing as unrecognizable command...
Anythign i have to install more for to perform this function ?

Feb 22, 2008 at 6:03 PM
It seems you have Windows auth set in your IIS (try adding Anon).
Can you post the WCF config section in your web.config file so we can check your settings there?
Feb 25, 2008 at 10:21 AM
This is a part of my web config file, (client)
<binding name="WSHttpBinding_IHelloWorldService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
<message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/>
<endpoint address="http://nimesh/WebService/HelloWorldService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBindingIHelloWorldService" contract="IHelloWorldService" name="WSHttpBindingIHelloWorldService">
<userPrincipalName value="NIMESH\ASPNET"/>

I tried botht the tick marks... but its showing the same error...

Now i am facing the problem only when the service is hosted in the IIS, if i am not hosting it in the IIS, its working fine adding by the reference(URL : when the service is viewed int he browser,it gives a URL).


Feb 25, 2008 at 3:22 PM
The config file seems to be fine. Try with IIS and set in Autrhentication Options only Anonymous Authentication enabled.
The rest should be disabled.
With this setting in IIS you should also be able to browse the svc page and get access with out any credential dialog and see the standard ws page with your public operation (WebMethods).