I've a WCF Service on both servers IIS7/ISA/Win2008 and IIS6/Apache Reverse-Proxy/Win2003.
And a client app that downloads and uploads files (approx. 10MB).
When downloading there are no problems. But if I upload a file on some client machines a
have a strange problem. They have all DSL 5 or 6mbps bandwidth. On some client machines the upload
finishes after a few seconds. And some client machines it sends tiny chunks with pauses (see screenshot) and takes much time (after a long time I terminate the process).
Screenshot: http://i51.tinypic.com/6glq90.png
I tried hundred different configurations and search and read complete google with no success.
I tried it on VirtualBox with Win7 as guest and host. With NAT I get this problem but with network bridge there is no problem!!!
Our customer have this problem too, but I don't know what for network settings they have.
Update!!
The problem has gone suprisingly at our customer. Now, the problem consists only in a VirtualBox hosted Windows of any version which network is configured as NAT.
WCF Service web.config:
<configuration>
<system.web>
<httpRuntime maxRequestLength="2097151" executionTimeout="100" />
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="MyFileServiceBehavior" name="MyWeb.Services.FileService">
<endpoint binding="basicHttpBinding" bindingConfiguration="HttpBinding_MTOM"
bindingNamespace="http://myweb.com/services/file" contract="MyWeb.Services.IFileService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="HttpBinding_MTOM" messageEncoding="Mtom" transferMode="Streamed"
closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
maxBufferSize="65536" maxReceivedMessageSize="99965536" maxBufferPoolSize="524288">
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MyFileServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<serviceCertificate findValue="MyServerCert" storeLocation="LocalMachine"
storeName="My" x509FindType="FindBySubjectName" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
Client app.config:
<configuration>
<system.net>
<defaultProxy useDefaultCredentials="true">
<proxy autoDetect="True" />
</defaultProxy>
</system.net>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IFileService" maxBufferSize="65536"
maxBufferPoolSize="524288" maxReceivedMessageSize="99965536"
messageEncoding="Mtom" transferMode="Streamed"
closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:30:00">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://myweb.com/services/FileService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileService"
contract="MyWeb.Services.IFileService" name="BasicHttpBinding_IFileService">
<identity>
<certificate encodedValue="NBgkqhki... and so on ...5fOM4v85In+" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
How I'm sending it on the client:
MyFileServiceRef.FileServiceClient fsClient = new MyFileServiceRef.FileServiceClient();
fsClient.Open();
using ( FileStream fs = File.Open( filename, FileMode.Open, FileAccess.Read ) )
{
fsClient.Upload( ID, filename, credentials, fs );
}
fsClient.Close();
How I'm reading it on server:
public void Upload( FileTransferRequest request )
{
byte[] fileBuffer = null;
using ( MemoryStream ms = new MemoryStream() )
{
try
{
byte[] buffer = new byte[4096];
int read = 0;
while ( ( read = request.Data.Read( buffer, 0, buffer.Length ) ) != 0 )
{
ms.Write( buffer, 0, read );
}
fileBuffer = ms.ToArray();
}
finally
{
request.Data.Close();
request.Data.Dispose();
}
}
// ... here I'm storing it on sql server
}