sachin dev

Hi,

I am returning a Cashflow object from a WCF service, like this.

[OperationContract]

[ServiceKnownType(typeof(Cashflow))]

Cashflow GetCashflow();

The cashflow objects contains a list of double values.

After receiving the cashflow object in the WCF client, i am printing the double values contained in it in a text file. It works well, till the file size is around 500 kb. If the cashflow object is bigger, meaning, the list contains more double values, I get an exception "An error occurred while receiving the HTTP response to http://server.corp.net:1000/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."

When I saw the logs in the IIS, the sc-status was 200 and sc-win32-status was 64.

I have put maxReceivedMessageSize as 2147483648 in the config file of the client. I am using the wsHttpBinding.

I think that I am getting the error coz I am trying to transport a large amount of data through WCF. But in that case the standard error is "The maximum message size quota for incoming messages has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element." Is it possible in some way to return very large data objects in WCF service.

Will using the netTcpBinding help me in this

Can anybody help me on this

Thank you very much.

-Sachin




Re: Windows Communication Foundation (Indigo) transport size limit for WCF

JDPeckham

stream it

or stick it in a gzip stream then send it over the wire.






Re: Windows Communication Foundation (Indigo) transport size limit for WCF

Allan-Nielsen

default all bindings have the transferMode=Buffered, try set this to Streaming.

you can read more about this here

Allan





Re: Windows Communication Foundation (Indigo) transport size limit for WCF

sachin dev

thank you Allan,

thanks James.

i might bother you once again, after retrying.






Re: Windows Communication Foundation (Indigo) transport size limit for WCF

Khalid Jayoussi

try this in buffered mode

<bindings>
<netTcpBinding>
<binding name="SomeBinding">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" />
</binding>
</netTcpBinding>
</bindings>





Re: Windows Communication Foundation (Indigo) transport size limit for WCF

sachin dev

thanks Khalid,

I had tried this, doesn't help.






Re: Windows Communication Foundation (Indigo) transport size limit for WCF

Khalid Jayoussi

give ur config file. I already get this problem b4 and its fixed now. I am trasfering about 10 MB for each file using buffered mode. if you host ur service using console application it will work fine with this confg. but if you are using IIS its limited to 4MB i think. I will check it and back again to you





Re: Windows Communication Foundation (Indigo) transport size limit for WCF

sachin dev

< xml version="1.0" encoding="utf-8" >
<configuration>

<system.web>
<httpRuntime maxRequestLength = "2097151"/>
</system.web>


<system.serviceModel>

<services>

<service name="ServiceClass" behaviorConfiguration="MyServiceTypeBehaviors" >

<!-- Add the following endpoint. -->

<!-- Note: your service must have an http base address to add this endpoint. -->

<endpoint contract="IServiceClass" binding= "wsHttpBinding" address=""
bindingConfiguration="WSHttpBinding_IServiceClass" />

</service>

</services>

<behaviors>

<serviceBehaviors>

<behavior name="MyServiceTypeBehaviors" >

<!-- Add the following element to your service behavior configuration. -->

<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />

</behavior>

</serviceBehaviors>

</behaviors>

<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IServiceClass" closeTimeout="00:05:00"
openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00"
bypassProxyOnLocal="true" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
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="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>

<netTcpBinding>
<binding name="netTcpBinding_IServiceClass" closeTimeout="00:05:00"
openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:05:00"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode ="Streamed" >
<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" />
<message clientCredentialType="Windows"
algorithmSuite="Default" />
</security>
</binding>
</netTcpBinding>

</bindings>
</system.serviceModel>

</configuration>

Actually, I tried using netTcpBinding, but later realised that IIS 6.0 doesn't support it.

I can only work on wsHttpBinding for now.




Re: Windows Communication Foundation (Indigo) transport size limit for WCF

Khalid Jayoussi

well when you use streaming you can not use message-level transfer security. when streaming with tcp binding you also can not enable reliable messaging.



Re: Windows Communication Foundation (Indigo) transport size limit for WCF

Brian McNamara - MSFT

I think that you need to update the ReaderQuotas on the client-side binding. That is, I bet you are missing this

<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
or possibly

maxReceivedMessageSize="2147483647"
in the client config file.

If that doesn't solve it, configure tracing on both server and client and inspect the trace logs, they are likely to contain the root exception causing the problem. http://msdn2.microsoft.com/en-us/library/ms733025.aspx






Re: Windows Communication Foundation (Indigo) transport size limit for WCF

sachin dev

thanks brian and khalid,

i did as you told.

actually, the problem is related to the default buffer size of IIS.






Re: Windows Communication Foundation (Indigo) transport size limit for WCF

Brian McNamara - MSFT

I see; is your issue resolved now




Re: Windows Communication Foundation (Indigo) transport size limit for WCF

sachin dev

No. I tried after increasing the value of AspMaxRequestEntityAllowed in the MetaBase.xml file of IIS. But it didn't work.

I tried with a self hosting service, it didn't work. So it might not be problem with IIS.

I will have to implement tracing to identify the problem, as you said(I have not done it, yet).






Re: Windows Communication Foundation (Indigo) transport size limit for WCF

Khalid Jayoussi

Is this resolved

if not, please turn off reliableSession as below

reliableSession ordered="false"

Thanks





Re: Windows Communication Foundation (Indigo) transport size limit for WCF

Shital Shah

I'd been getting same error even though I did not used the CDATA and after hours of debugging found the fix. The Exception details gets truncated in VS.Net to first 1024 chars so there is limited info directly available for this problem. However I would be surprised if not too many people are running in to same issue because this is essentially caused by default settings in generated output.config. So anyone trying to copy paste these settings in client and try recieving large XML, would run in to this. The fix is simple. Just change following line that you had copied from output.config in to your App.Config on client (no server side change is required):

<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />

Original line looks like this:

<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />

The best way to investigate this kind of problems is to enable tracing on client side (not on the web sever). Install the WIndows SDK, run the Service Confiiguration Editor and point it to your App.Config. The turn on settings in Diagnostics node. This would generate .svclog files which can view using Service Trace Viewer. Lot of information here is interesting but most interesting part is the Process Action node which will show you (finally) the full Exception and all the InnerException. The innermost exception is pretty detailed and reads like this:

The maximum nametable character count quota (16384) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing - long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 2898.

Unfortunately, this gets truncated when viewing from VS.Net IDE