需要在两个 .NET 进程之间快速且频繁地进行通信
所以我有以下设置:
- 一方面使用 .NET dll 的 VB6 应用程序,另一方面
- 使用 .NET 服务
VB6 应用程序使用一个小的接口 dll 与我们的新基础设施(服务等)进行通信,并且几乎无法更改在功能上。我们选择使用带有这样的绑定的 WCF
<system.serviceModel>
<client>
<endpoint address="net.tcp://localhost:8001/HostCommunicator" binding="netTcpBinding" bindingConfiguration="NETTcpBinding" contract="IHostCommunicationContract"/>
</client>
<bindings>
<netTcpBinding>
<binding name="NETTcpBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" receiveTimeout="00:10:00" sendTimeout="00:10:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
<startup>
来进行通信。
对于单个请求来说,这工作得很好而且很快,但 VB6 应用程序的一种模式是一种批处理模式,它为它处理的每个文件发送一个单独的请求。每秒大约会有 1-4 个请求。
在完成许多请求之前,这种方法可以正常工作。在我当前的机器和软件版本上,这是 50 个请求。如果我启动 VB6 应用程序,它会再次执行 50 个请求。超过限制后,应用程序会在 CPU 使用率达到 99% 时挂起。
我们正在使用双工通道合约。
So I have the following setup:
- a VB6 Application using a .NET dll on the one hand
- a .NET Service on the other end
The VB6 application uses a small interface dll to communicate to our new infrastructure (servies etc) and can hardly be changed in functionality. We choose to use WCF with a binding like this
<system.serviceModel>
<client>
<endpoint address="net.tcp://localhost:8001/HostCommunicator" binding="netTcpBinding" bindingConfiguration="NETTcpBinding" contract="IHostCommunicationContract"/>
</client>
<bindings>
<netTcpBinding>
<binding name="NETTcpBinding" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" receiveTimeout="00:10:00" sendTimeout="00:10:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
<startup>
to communicate.
This works fine and fast for single requests but one mode of the VB6 Application is a kind of batch mode where it sends an individual request for each file it processes. There will be about 1-4 requests per second.
This works fine until a number of requests is done. On my current machine and software version this are 50 requests. If I start the VB6 application over it does 50 requests again. After the limit the application hangs at 99% CPU usage.
We are using a duplex channel contract.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否记得关闭连接?看来您没有关闭连接,只是为每个请求打开新的连接?
Have you remembered to close your connections? It looks like you are not closing the connections, just opening new ones for each request?