.net 远程处理 - List 的问题
我正在使用 .Net Remoting 开发客户端-服务器应用程序。我想从我的服务器返回一个列表以响应某个方法调用,但是我收到一个异常,说 SoapFormatter 基本上无法处理泛型。我需要一种解决方法,以便能够使用泛型,或者指导如何使用 XmlSerializer 或 DataContractSerializer。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为他们没有在 .NET 2.0 中添加对 SoapFormatter 和泛型的任何额外支持。一个快速的解决方法是将列表作为数组传递给客户端。
如果您必须使用泛型(我个人会考虑将其升级到 WCF),MSDN 远程处理示例。
That's cause they didn't add any additional support for the SoapFormatter and generics in .NET 2.0. A quick workaround would be to pass the List to the client as an array.
If you must use Generics (personally I'd consider upgrading this to WCF), there are some examples on how to do so in the MSDN remoting examples.