Home » Microsoft TechnologiesRSS

An error occurred while receiving the HTTP response to xxx problem. WCF comunication

I have been having this problem transmiting data (XML from a microsoft sincronization session v1.0) to a WCF service on IIS 6.
I have enabled tracing on my WCF service, verbose, but nothing shows up. No exceptions what so ever.
My client connects over a GPRS line. But i have also done this over ADSL with the same results.
The thing is, it starts transmiting ( i can see it on wireshark) but suddenly the server side sends a TCP RST packet and the transmission ends with a client exception like

An error occurred while receiving the HTTP response to http://blabalblabla/Service.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

It never actually gets to my code (otherwise i would probably see something on my trace)

Thank you!

My binding are this (on client):
<basicHttpBinding>
<
bindingname="BasicHttpBinding_Issap_mainSyncContract"closeTimeout="00:01:00" openTimeout="00:01:00"receiveTimeout="00:10:00"sendTimeout="00:10:00" allowCookies="false"bypassProxyOnLocal="false"hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647"maxBufferPoolSize="2147483647"maxReceivedMessageSize="2147483647" messageEncoding="Text"textEncoding="utf-8"transferMode="Buffered" useDefaultWebProxy="true">
<
readerQuotasmaxDepth="2147483647"maxStringContentLength="2147483647" maxArrayLength="2147483647"maxBytesPerRead="2147483647"maxNameTableCharCount="2147483647" />
<
securitymode="None">
   <
transportclientCredentialType="None"proxyCredentialType="None" realm="" />
   <
messageclientCredentialType="UserName"algorithmSuite="Default" />
</
security>
</
binding>
</
basicHttpBinding>

and on the server side:

<basicHttpBinding>
        <binding name="BasicHttpBinding_Issap_mainSyncContract" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="67108864" maxBufferPoolSize="67108864" maxReceivedMessageSize="67108864"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647"
           maxBytesPerRead="8192" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>

<system.web>
    <compilation debug="true" />
    <httpRuntime maxRequestLength="2097151"/>
  </system.web>

I have

<

dataContractSerializermaxItemsInObjectGraph="2147483647"/>

on both sides.




 

10 Answers Found

 

Answer 1

Two things:

1. Whenever a client  application throws a "an error  occurred while receiving  HTTP response...", most likely cause is that the service  errored out without sending a response. Activity Tracing on System.ServiceModel and System.ServiceModel.MessageLogging should help you locate the error on the service side.

2. I see that you are overriding maxItemsInGraph and maxRequestLength. Just curious, are you sending/receiving large amount of data. If so, the reader quotas at the binding  level will have to be seen more carefully as well.
 

Answer 2

Hello Vivek.
Tnks for you answer. As i stated before i have run the trace tool but nothing shows  up.
Nothing realy. No file is created.
What i see on wireshark is a RST on the connection (server side) when its receiving  things (XML)

I am testing the worse case scenario, so yes, i am "uploading" about 3.5 mb (!!)

If happen to have wireshark you can load this file into it.
http://imediatavendingws.imediata.pt/trace_real_contra_iis.zip - rename it to pcap extension
the last entry is the RST.

My diagnostics config on the server  side:
<system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Verbose,ActivityTracing" propagateActivity="true">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelTraceListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="xxxx\xxx\xxx\Web_tracelog.svclog"
        type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
    </sharedListeners>
    <trace autoflush="true" />
  </system.diagnostics>

My bindigs on the server side  are;

<basicHttpBinding>
        <binding name="BasicHttpBinding_Issap_mainSyncContract" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="67108864" maxBufferPoolSize="67108864" maxReceivedMessageSize="67108864"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="8192" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>

on the client  side they are diferent but i dont realy know if it matters on the cliente side.

<basicHttpBinding>
              <binding name="BasicHttpBinding_Issap_mainSyncContract" closeTimeout="00:01:00"
                  openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
                  allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                  maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
                  maxReceivedMessageSize="2147483647" messageEncoding="Text"
                  textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                  <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                      maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                  <security mode="None">
                      <transport clientCredentialType="None" proxyCredentialType="None"
                          realm="" />
                      <message clientCredentialType="UserName" algorithmSuite="Default" />
                  </security>
              </binding>
          </basicHttpBinding>

One other thing  to note.
I if do this client-server transaction on my LAN between two PCs all is well.
It seems to be something on TCP. could it be? Is it, usally?
Tnks
 

Answer 3

Hello Vivek.
Tnks for you answer. As i stated before i have run the trace tool but nothing shows  up.
Nothing realy. No file is created.
What i see on wireshark is a RST on the connection (server side) when its receiving  things (XML)

I am testing the worse case scenario, so yes, i am "uploading" about 3.5 mb (!!)

If happen to have wireshark you can load this file into it.
http://imediatavendingws.imediata.pt/trace_real_contra_iis.zip - rename it to pcap extension
the last entry is the RST.

My diagnostics config on the server  side:
<system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Verbose,ActivityTracing" propagateActivity="true">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelTraceListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="xxxx\xxx\xxx\Web_tracelog.svclog"
        type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
    </sharedListeners>
    <trace autoflush="true" />
  </system.diagnostics>

My bindigs on the server side  are;

<basicHttpBinding>
        <binding name="BasicHttpBinding_Issap_mainSyncContract" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="67108864" maxBufferPoolSize="67108864" maxReceivedMessageSize="67108864"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="8192" maxNameTableCharCount="2147483647" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>

on the client  side they are diferent but i dont realy know if it matters on the cliente side.

<basicHttpBinding>
              <binding name="BasicHttpBinding_Issap_mainSyncContract" closeTimeout="00:01:00"
                  openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
                  allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                  maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
                  maxReceivedMessageSize="2147483647" messageEncoding="Text"
                  textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                  <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                      maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                  <security mode="None">
                      <transport clientCredentialType="None" proxyCredentialType="None"
                          realm="" />
                      <message clientCredentialType="UserName" algorithmSuite="Default" />
                  </security>
              </binding>
          </basicHttpBinding>

One other thing  to note.
I if do this client-server transaction on my LAN between two PCs all is well.
It seems to be something on TCP. could it be? Is it, usally?
Tnks

Web Developer

Hi All,

I am getting an error  as "an error occurred  while receiving http  response...",

below i mentioned my config details  and i set maxReceivedMessageSize="999999999"

<bindings>
   <wsHttpBinding>
    <!--phtoRequest-->
    <binding name="WSHttpBinding_IShotRequestService" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="999999999" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
     <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
     <security mode="Message">
      <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
      <message clientCredentialType="Windows" negotiateServiceCredential="false" algorithmSuite="Basic128" establishSecurityContext="false"/>
     </security>
    </binding>
</wsHttpBinding>

when i am try to save some more records , i am getting this error..

any help or suggestion will be appriciated

 

Answer 4

Hello,

after wasting alot of time thinking it was my Enum or something else I figured out that I was simply returning alot of rows, around 18000. I know it's bad to return that many but at the same time I needed to in order to make my paging work properly in GridView so I let it be just for testing purposes not realizing that was the last thing  I did before I broke it. There's probably a parameter I could have tweaked but this error  is totally not specific and led me to a wild goose chase of creating new services, methods and all kinds of other impractical things that wasted my time.

The WCF Tracing tool didn't work either since it kept showing me the same error as my exception.
 

Answer 5

Did you turn on tracing  on the service  and the client? One of them should have shown you which quota you were exceeding

 

Answer 6

Yes I did. However tracing  on the server  didn't seem to produce the trace file. Documentation and examples I read didn't specify on which (Server or Client) I have to enable the tracing on but it worked on the client  so I went with that.
 

Answer 7

This is probably happening at the server  or you would get more info at the client. I made a short screencast about turning on tracing  via the GUI to find serialization problems tool a while back - I would give it another go

http://rocksolidknowledge.com/ScreenCasts.mvc/Watch?video=WCFTracing.wmv

 

Answer 8

You need to modify the config file in the web service  to accept larger input strings.

Adding the following line  resolved this issue for me.
<system.web>
   <httpRuntime maxRequestLength="32768" />
</system.web>

 

Answer 9

If you are returning an Entity using .net Framework 4.0 with a wcf  method and getting this error  then read this article:

http://dotnet.dzone.com/news/entity-framework-4-wcf-lazy

 

 

 

 

 

Answer 10

Thanks Red-VIII, your comment help me a lot, and i am able to solve my problem.

Thanks,

Brijen A. Patel

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter