Здравствуйте, у меня проблема с загрузкой файла с использованием wcf и потоковой передачи. Когда я переключаюсь с TransferMode = «Streamed» на «Buffered» на клиенте, он работает, хотя и не потоковый, но не исключение. Когда я переключаю клиента на «Потоковое», это терпит неудачу. Я боролся с этим уже несколько часов, и просто увеличил все размеры, чтобы не потерпеть неудачу. Я не могу найти, что происходит не так. Кто-нибудь может это заметить?
У меня есть сервис со следующей конфигурацией:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="GreenWebManagerServiceBinding" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed" messageEncoding="Text" textEncoding="utf-8" >
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="None">
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="GreenWebManagerServiceBehavior" name="GreenWebManagerService.ManagerService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:50036/GreenWebManagerService"/>
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="GreenWebManagerServiceBinding" contract="GreenWebManagerService.IGWManagerService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="GreenWebManagerServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="500" maxConcurrentSessions="500" maxConcurrentInstances="500" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
и клиент со следующей конфигурацией:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IGWManagerService" closeTimeout="10:01:00"
openTimeout="10:01:00" receiveTimeout="10:10:00" sendTimeout="10:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed"
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>
</bindings>
<client>
<endpoint address="http://localhost:50036/GWManagerService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGWManagerService"
contract="ManagerService.IGWManagerService" name="BasicHttpBinding_IGWManagerService" />
</client>
</system.serviceModel>
Я получаю следующую ошибку и трассировку стека, обратите внимание, что числа считаны в байтах, которые я записываю в консоль:
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.ServiceModel.ProtocolException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.ServiceModel.ProtocolException' occurred in System.ServiceModel.dll
256
4352
69888
135424
200960
266496
332032
397568
463104
528640
594176
659712
725248
790784
856320
921856
987392
1052928
1118464
1184000
1249536
1315072
1380608
1446144
1511680
1577216
1642752
1708288
1773824
1839360
1904896
1970432
2002629
2002629
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'System.ServiceModel.ProtocolException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.ServiceModel.ProtocolException' occurred in mscorlib.dll
Step into: Stepping over method without symbols 'System.Reflection.TargetInvocationException.TargetInvocationException'
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Step into: Stepping over method without symbols 'System.RuntimeType.CreateInstanceImpl'
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Step into: Stepping over method without symbols 'MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateInstance'
A first chance exception of type 'System.Xaml.XamlObjectWriterException' occurred in System.Xaml.dll
Step into: Stepping over method without symbols 'System.Windows.Markup.WpfXamlLoader.Load'