Есть сервис, который отдает клиентам файлы используя стриминг:
1.
2.
3.
4.
public virtual Stream GetFile()
{
byte[] content = File.ReadAllBytes(Path.Combine(_pathToFile, _fileName));
return new MemoryStream(content);
}
дальше клиент получает от сервиса Stream и сохраняет его к себе на диск. Проблема в том, что загрузка файлов не работает у удаленных клиентов - если клиент находится в нашей локальной сети, все загружается, если нет - загружаются первые 900-1000кб, после чего загрузка останавливается до истечения тайм-аута. Пробовал из дома загрузить файл - нормально работает только если установлено vpn-соединение, иначе загружает кусок и вылетает с TimeoutException.
Подскажите, куда смотреть?
конфиги такие:
сервер
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<service name="ServerLogic.ServiceImpl" behaviorConfiguration="myServiceBehavior">
<!-- Service Endpoints -->
<host>
<baseAddresses>
<add baseAddress="http://localhost:19311/ABC/Service/"/>
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding" contract="ServiceInterface.IService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="myServiceBehavior">
<serviceMetadata httpGetEnabled="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration
клиент
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" closeTimeout="00:01:00"
openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:01:30"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="67108864" maxBufferPoolSize="67108864" maxReceivedMessageSize="67108864"
messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://myserver.mydomain.ru:19311/ABC/Service/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
contract="ServiceReference1.IService" name="BasicHttpBinding_IService" />
</client>
</system.serviceModel>
</configuration>