我正在尝试创建一个下载应用程序,其中将有四个或更多下载队列,用户可以使用这些队列从服务器下载文件。在不让队列相互阻塞的情况下,实现这一目标的最佳解决方案是什么。我在不同的后台线程中启动每个下载队列,当字节从服务中下载时,该线程向 WPF 客户端 UI 报告进度。但是,新的下载队列会阻止任何以前运行的下载队列。我尝试在 google 和 StackOverflow 上进行大量搜索,但仍然无法解决问题
应用方法: 我们使用 Windows Azure 服务总线通过 NetTcpRelayBinding 连接到我们的 WCF 服务。
客户端配置:
<system.serviceModel>
<bindings>
<!-- Application Binding -->
<netTcpRelayBinding>
<binding name="default"
connectionMode="Hybrid"
maxReceivedMessageSize="2147483647"
transferMode="Streamed"
closeTimeout="01:00:00"
openTimeout="00:30:00"
sendTimeout="infinite"
receiveTimeout="infinite"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxConnections="500"
listenBacklog="200">
<security mode="None"/>
<readerQuotas maxBytesPerRead="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" />
<reliableSession enabled="false" ordered="true" />
</binding>
</netTcpRelayBinding>
</bindings>
<client>
<!-- Application Service -->
<endpoint name="RelayEndpoint" contract="DDMInterface.IBaseService" binding="netTcpRelayBinding" bindingConfiguration="default" address="" />
</client>
服务配置:
<system.serviceModel>
<bindings>
<!-- Application Binding -->
<netTcpRelayBinding>
<binding name="default"
connectionMode="Hybrid"
maxReceivedMessageSize="2147483647"
transferMode="Streamed"
closeTimeout="01:00:00"
openTimeout="00:30:00"
sendTimeout="infinite"
receiveTimeout="infinite"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxConnections="500"
listenBacklog="200">
<security mode="None"/>
<readerQuotas maxBytesPerRead="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" />
<reliableSession enabled="false" ordered="true" />
</binding>
</netTcpRelayBinding>
</bindings>
<services>
<!-- Application Service -->
<service name="DDMService.DDMBaseService" behaviorConfiguration="ThrottleBehavior">
<endpoint name="RelayEndpoint"
contract="DDMInterface.IBaseService"
binding="netTcpRelayBinding"
bindingConfiguration="default"
address=""/> <!--behaviorConfiguration="defaultBehavior"-->
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ThrottleBehavior">
<serviceThrottling maxConcurrentCalls="2147483647" maxConcurrentInstances="2147483647" />
<!--maxConcurrentSessions="2147483647"-->
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="defaultBehavior">
<dispatcherSynchronization asynchronousSendEnabled="true"/>
</behavior>
</endpointBehaviors>
</behaviors>
服务行为:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Multiple)]
public class DDMBaseService : IBaseService
{
自从过去 2 周以来,我一直在努力解决这个问题,但仍然无法解决它。请通过建议链接或解决方案帮助我找到合适的方法。如果需要,请询问更多信息。提前致谢...