WCF 服务和 .net 2.0 Windows 应用程序之间是否可以进行双工通信?如果是这样,怎么办?
非常不言自明。我需要一项服务来在发生情况时通知我的客户端应用程序,但该应用程序位于 .net 2.0 中,我不愿意仅为此功能进行升级。
WCF 服务和 .net 2.0 应用程序之间是否可以进行双工通信?
Pretty self-explanatory. I have a need for a service to notify my client app if something happens, but the app is in .net 2.0 and I am loath to upgrade just for this functionality.
Is it possible to have duplex communication between a WCF service and a .net 2.0 app?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最终,是的...因为在最坏的情况下,WCF 允许您编写自己的自定义通道,这样您几乎可以做任何事情。但是...
“最简单”的方法之一可能是使用类似这样的自定义双工通道构建在HTTP。显然.NET 2.0 支持HTTP,因此这是一个通用协议。
WCF 确实有一个名为 basicHttpBinding 的旧版绑定,它支持旧式 ( WS 1.1) .NET 2.0 时代的 SOAP Web 服务。这只是一个请求-响应,因此要创建双工通道,您需要构建一个构建在两个单工端点之上的自定义绑定。
Ultimate, yes... because in the worst case WCF lets you write your own custom channels so you can pretty much do anything. But...
One of the 'simplest' ways might be to use something like this custom duplex channel built on top of HTTP. Obviously .NET 2.0 supports HTTP so thats a common protocol.
WCF does have a legacy binding called basicHttpBinding which supports the old-style (WS 1.1) SOAP webservices from .NET 2.0 era. This is only a request-response so to make a duplex channel you would need to build a custom binding which builds on top of two simplex endpoints.
严格来说不会,因为 WCF 不会与 .NET 2.0 框架一起运行,但这看起来并不是什么大问题。 WCF 是随 .NET 3.0 框架一起引入的。它带有 wsDualHttpBinding 双工功能这将提供客户通知。
您的 ASP.NET 2.0 应用程序与 .NET 3.0 框架完全兼容,因为 .NET 3.0 中的 ASP.NET 命名空间没有太大变化,因此您不必担心升级应用程序以利用 WCF 双工绑定。此 ASP.NET 论坛帖子 提供了各种 .NET 框架的更详细说明版本和 ASP.NET。升级比滚动您自己的双工客户端要轻松得多。
Strictly speaking no since WCF will not run with the .NET 2.0 framework but this is not the big issue it would seem. WCF was introduce with the .NET 3.0 framework. It came with the wsDualHttpBinding duplex functionality which will provide for client notification.
Your ASP.NET 2.0 app is completely compatible with the .NET 3.0 framework because the ASP.NET namespaces did not change very much in .NET 3.0 so you shouldn't worry about upgrading your app to take advantage of the WCF duplex binding. This ASP.NET forum post provides a more detailed explanation of the various .NET framework versions and ASP.NET. The upgrade will be much less painful than rolling your own duplex client.