WCF Limits

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hi All

I have a Problem with sending big Objects or big List<> via WCF.
I wrote a test for this where I generate 2000 Objects and send them in
packages
ahbl.DeleteApplicationHistoryByQuery(q);
Code locks like this:
VoList<ApplicationHistoryVO> list = new VoList<ApplicationHistoryVO>();
for (int i = 0; i < 2000; i++)
{
list.Add(CreateApplicationHistoryVO("<TestCleintInfo>Info " + i +
"</TestCleintInfo>", "Speed Test User", 1, DateTime.Now,
Guid.NewGuid().ToString(), 1, 1));
if (list.Count == 810)
{
ahbl.SaveApplicationHistoryList(list);
list = new VoList<ApplicationHistoryVO>();
}
}
Very easy Code! But every Time my packages get bigger than 826 Items I get
the following Exception
The underlying connection was closed: The connection was closed
unexpectedly. ---> System.Net.WebException: The underlying connection was
closed: The connection was closed unexpectedly
I already add the System.diagnostics to the web and app.config to get the
WCF Exception but nothing. I also take a look in the Event View and there is
also just the “The underlying connection was closed†Exception

Does anyone have an Idea who I can find out where the Problem is?

Regards Michael

WCF Config
Each Endpoint has the following basicHttpBinding and Behavior. The Client
Side is configured the some way.
<basicHttpBinding>
<binding name="Binding" closeTimeout="00:20:00" openTimeout="00:20:00"
receiveTimeout="00:20:00" sendTimeout="00:20:00"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" transferMode="Buffered" textEncoding="utf-8">
<security mode="None">
<!--Transport-->
<transport clientCredentialType="None"/>
</security>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
<behaviors>
<serviceBehaviors>
<behavior name="Behavior">
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceMetadata httpGetEnabled="true"/>
<dataContractSerializer
maxItemsInObjectGraph="2147483647"/>
</behavior>
<behavior name="contactServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="webBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
 
I allready tryed this on both sides but nothing the server the Client is
writing the files with some useless stuff in side!


<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging" switchValue="Error,
Warning, ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type=""/>
</add>
<add name="ServiceModelMessageLoggingListener">
<filter type=""/>
</add>
</listeners>
</source>
<source name="System.ServiceModel" switchValue="Error, Warning,
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="e:\web_messages_web.svclog"
type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp,
Callstack">
<filter type=""/>
</add>
<add initializeData="e:\web_tracelog_web.svclog"
type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelTraceListener" traceOutputOptions="Timestamp, Callstack">
<filter type=""/>
</add>
</sharedListeners>
<trace autoflush="true"/>
</system.diagnostics>
 
You need to look at the output files via this tool:

"C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin\SvcTraceViewer.exe"


Example config setting:

<system.diagnostics>

<trace autoflush="true" />

<sources>

<source name="System.ServiceModel"

switchValue="Information, ActivityTracing"

<listeners>

<add name="sdt"

type="System.Diagnostics.XmlWriterTraceListener"

initializeData= "c:\wutemp\Host1.svclog" />

</listeners>

</source>

</sources>

</system.diagnostics>










You absolutely need to figure out how to write and read svclog files with
the tool.



Do you have enough max size for your binding?


Here is a sample to provide a hint:


<netNamedPipeBinding>

<binding name="NamedPipeBindingName1"

hostNameComparisonMode="StrongWildcard"

maxBufferSize="9000000" <!-- HERE -->

maxConnections="500"

maxReceivedMessageSize="9000000" <!-- HERE -->

receiveTimeout="00:20:00"

transactionFlow="false">

<security mode="Transport">

</security>

</binding>

</netNamedPipeBinding>
 
the answere was that I has to change the maxRequestLength in httpRuntime!

<system.web>
<httpRuntime maxRequestLength="102400" executionTimeout= "3600" />
</system.web>
 
Back
Top