.NET Remoting 真的被弃用了吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1294494/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is .NET Remoting really deprecated?
提问by Mark
Everyone is saying how .NET Remoting is being replaced by WCF, but I'm wondering just how accurate that is. I haven't seen any official word that Remoting is being deprecated, and it seems to me there are certainly scenarios where Remoting makes more sense than WCF. None of the Remoting-related objects or methods have been deprecated, even in version 4.0 of the framework. It is also my understanding that System.AddIn in the 3.5 and 4.0 frameworks use Remoting.
每个人都在说 .NET Remoting 如何被 WCF 取代,但我想知道这有多准确。我还没有看到任何关于 Remoting 被弃用的官方消息,在我看来,肯定存在 Remoting 比 WCF 更有意义的情况。没有任何与 Remoting 相关的对象或方法被弃用,即使在框架的 4.0 版中也是如此。3.5 和 4.0 框架中的 System.AddIn 使用 Remoting 也是我的理解。
Does anyone have any official word to the contrary?
有没有人有任何相反的官方说法?
In the article, Choosing Communication Options in .NET(for 3.0, as that's the latest version of that article), it states:
在文章中选择 .NET 中的通信选项(对于 3.0,因为这是该文章的最新版本),它指出:
8 Cross-application domain communications
If you need to support communication between objects in different application domains within the same process, you must use .NET remoting.
8 跨应用域通信
如果需要支持同一进程内不同应用程序域中的对象之间的通信,则必须使用 .NET 远程处理。
Now, that, of course, isn't accurate, as WCF can certainly be used to cross appdomain boundaries, but is it giving the official recommendation for that scenario?
现在,这当然不准确,因为 WCF 当然可以用于跨越应用程序域边界,但它是否为该场景提供了官方建议?
Update: I sent Clemens Vasters (who was on the team that owns Remoting and WCF) this question:
更新:我向 Clemens Vasters(他在拥有 Remoting 和 WCF 的团队中)发送了这个问题:
Clemens, I understand you're on the team that owns both remoting and wcf, and I have a couple of questions that I believe I need to go to the source for.
First, I have a question about whether remoting is going away. Specifically, we have a rather large application that uses remoting extensively for in-process cross-appdomain communication, and I was wondering if this usage of remoting is considered "legacy". If so, will AppDomain.CreateInstance and friends be replaced with something else?
Clemens,我知道您所在的团队同时拥有远程处理和 wcf,而且我有几个问题,我认为我需要去寻求源头。
首先,我有一个关于远程处理是否会消失的问题。具体来说,我们有一个相当大的应用程序,它广泛使用远程处理进行进程内跨应用程序域通信,我想知道这种远程处理的用法是否被视为“遗留”。如果是这样,AppDomain.CreateInstance 和朋友会被其他东西取代吗?
This is his reply:
这是他的回复:
Remoting is part of the .Net Framework and as such it isn't going away. COM has been in Windows since Windows NT 3.5/Windows 95 and hasn't gone away and I don't see that going away anytime soon, either.
That said, there is very minimal development investment going into Remoting. WCF is the successor of Remoting and supplants COM/DCOM for managed code.
For in-process, cross-appdomain communication Remoting is the CLR's native way of communicating. If you are seeing performance issues pumping larger amounts of data or very many messages in short time, you should take a serious look at WCF and the NetNamedPipeBinding.
远程处理是 .Net 框架的一部分,因此它不会消失。COM 从 Windows NT 3.5/Windows 95 开始就出现在 Windows 中,并且一直没有消失,我也认为它不会很快消失。
也就是说,进入远程处理的开发投资非常少。WCF 是 Remoting 的继承者,并取代了托管代码的 COM/DCOM。
对于进程内、跨应用程序域通信,远程处理是 CLR 的本机通信方式。如果您看到在短时间内抽取大量数据或非常多消息的性能问题,您应该认真查看 WCF 和 NetNamedPipeBinding。
采纳答案by RichardOD
Calling it a legacy technology is a more accurate description.
将其称为遗留技术是更准确的描述。
http://msdn.microsoft.com/en-us/library/72x4h507%28VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/72x4h507%28VS.85%29.aspx
This topic is specific to a legacy technology that is retained for backward compatibility with existing applications and is not recommended for new development. Distributed applications should now be developed using the Windows Communication Foundation (WCF).
本主题特定于为与现有应用程序向后兼容而保留的遗留技术,不建议用于新开发。现在应该使用 Windows Communication Foundation (WCF) 开发分布式应用程序。
Update: WCF doesn't distinguish between inter/intra/process/inter/intra-appdomain. If you are using single machine communication in WCF you use named pipes- using it should give good performance in virtually all realistic scenarios.
更新:WCF 不区分inter/intra/process/inter/intra-appdomain。如果您在 WCF 中使用单机通信,则使用命名管道 - 使用它应该在几乎所有现实场景中提供良好的性能。
For a performance comparison of various distributed communication technologies see here.
有关各种分布式通信技术的性能比较,请参见此处。
回答by Justin Niessner
Yes. Remoting is deprecated...and it's official from Microsoft. Here's the link:
是的。远程处理已被弃用……它是微软官方提供的。这是链接:
The first line in the article says in bold:
文章的第一行用粗体表示:
This topic is specific to a legacy technology that is retained for backward compatibility with existing applications and is not recommended for new development. Distributed applications should now be developed using the Windows Communication Foundation (WCF).
本主题特定于为与现有应用程序向后兼容而保留的遗留技术,不建议用于新开发。现在应该使用 Windows Communication Foundation (WCF) 开发分布式应用程序。
I thought the verbiage was 'deprecated' but apparently they refer to it as 'legacy'
我认为这些措辞已被“弃用”,但显然他们将其称为“遗留”
回答by Jean-Claude
If you like to migrate to .NET Core you have to find another solution for Remoting anyway:
如果您想迁移到 .NET Core,则无论如何都必须找到另一种远程处理解决方案:
.NET Remoting was identified as a problematic architecture. It's used for cross-AppDomain communication, which is no longer supported. Also, Remoting requires runtime support, which is expensive to maintain. For these reasons, .NET Remoting isn't supported on .NET Core, and we don't plan on adding support for it in the future.
.NET Remoting 被确定为有问题的架构。它用于不再支持的跨 AppDomain 通信。此外,远程处理需要运行时支持,维护成本很高。由于这些原因,.NET Core 不支持 .NET Remoting,我们不打算在未来添加对它的支持。
Source: https://docs.microsoft.com/en-us/dotnet/core/porting/libraries#remoting
来源:https: //docs.microsoft.com/en-us/dotnet/core/porting/libraries#remoting
回答by JohannesH
Clemens Vasters, the Technical Lead for the Microsoft .NET Service Bus (that means both Remoting as well as WCF) talks about WCF vs. Remoting in this forum post. To summarize the post he ends up recommending WCF over Remoting.
Clemens Vasters 是 Microsoft .NET 服务总线(这意味着远程处理和 WCF)的技术负责人,他在此论坛帖子中谈到了 WCF 与远程处理。总结这篇文章,他最终推荐 WCF 而不是 Remoting。
I'm not sure if .NET 4.0 uses remoting internally but you could try sending Clemens the question... I'm sure he knows the answer.
我不确定 .NET 4.0 是否在内部使用远程处理,但您可以尝试向 Clemens 发送问题...我相信他知道答案。
回答by Armando
I think that now (2015) it's quite clear even for cross application domains: https://msdn.microsoft.com/en-us/library/vstudio/ms180984(v=vs.100).aspx
我认为现在(2015 年)即使对于跨应用程序域也很清楚:https: //msdn.microsoft.com/en-us/library/vstudio/ms180984(v=vs.100).aspx
Remoting Cross AppDomainsThis topic is specific to a legacy technology that is retained for backward compatibility with existing applications and is not recommended for new development. Distributed applications should now be developed using the Windows Communication Foundation (WCF).
跨 AppDomains 远程处理本主题特定于一项遗留技术,保留该技术是为了与现有应用程序向后兼容,不建议用于新开发。现在应该使用 Windows Communication Foundation (WCF) 开发分布式应用程序。
Then WCF should be used for cross application domains too.
那么 WCF 也应该用于跨应用程序域。

