У меня есть служба wcf (служба парсера, byte [] => строка)
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple)]
размещено на iis (nettcpbinding)
На моей клиентской стороне у меня есть один миллион + байт [], подобный этому List (1000000), и я должен вызвать метод службы wcf как параллельный для анализа этого списка.
Я использовал вот так, но у меня есть узкое место (служба wcf не отвечает мне) после разбора сообщения 500000-700000. Где я делаю неправильную реализацию? Решает ли это мою проблему, если я реализую этот метод http://blogs.msdn.com/b/rjacobs/archive/2011/06/30/how-to-implement-a-wcf-asynchronous-service-operation-with-task-lt-t-gt.aspx (клиентская сторона в Parallel.Foreach та же строка ниже)
Service1 client =new Service1();
Parallel.Foeach(list,byteArray=>{
var result = client.Parse(byteArray);
string keyHash = string.combine(byteArray[0],byteArray[1],byteArray[3])
WriteDiffFile(keyHash,result); // maybe call in different task
WriteSameFile(result); // need lock for write to same file
});
моя конфигурация хоста wcf:
<system.serviceModel>
<diagnostics etwProviderId="9a712944-02ea-425a-bbd3-567a943b85df">
<endToEndTracing propagateActivity="false" messageFlowTracing="false" />
</diagnostics>
<services>
<service name="Pln3G.Services.EventParserService" behaviorConfiguration="Pln3G.WebServices.EventParserServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8001/pln3g/EventParserService/" />
</baseAddresses>
</host>
<endpoint address="" binding="netTcpBinding" bindingConfiguration="tcp_Unsecured" contract="Pln3G.Domain.Contracts.Service.IEventParserService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="tcp_Unsecured" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="2147483647" maxReceivedMessageSize="2147483647" portSharingEnabled="false" transactionFlow="false" listenBacklog="2147483647" closeTimeout="00:01:00" openTimeout="00:10:00" receiveTimeout="00:20:00" sendTimeout="00:10:00">
<readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None"></security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="Pln3G.WebServices.EventParserServiceBehavior">
<etwTracking profileName="ErrorsOnly Tracking Profile" />
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<!--1. MaxConcurrentSessions: default is 100 * ProcessorCount
2. MaxConcurrentCalls: default is 16 * ProcessorCount
3. MaxConcurrentInstances: default is the total of MaxConcurrentSessions and MaxConcurrentCalls -->
<serviceThrottling maxConcurrentCalls="32" maxConcurrentSessions="200" maxConcurrentInstances="232" />
<serviceMetadata httpGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
<behavior name="">
<etwTracking profileName="HealthMonitoring Tracking Profile" />
<serviceThrottling maxConcurrentCalls="32" maxConcurrentSessions="200" maxConcurrentInstances="232" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
моя клиентская конфигурация wcf:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IEventParserService" closeTimeout="00:01:00" openTimeout="00:10:00" receiveTimeout="00:20:00" sendTimeout="00:10:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
<readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<!--<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />-->
<security mode="None">
<transport clientCredentialType="None" protectionLevel="None" />
<message clientCredentialType="None" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://192.168.1.66:8001/pln3g/EventParserService.svc" behaviorConfiguration="ServiceViewEventBehavior"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IEventParserService"
contract="EventParserServiceReference.IEventParserService" name="NetTcpBinding_IEventParserService" />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="ServiceViewEventBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>