WCF 和嵌入式系统
我正在开发一个涉及嵌入式系统的项目,该系统运行非微软操作系统以及用于应用程序的 C 程序,并为其最终用户应用程序开发 .NET 软件。 对于使用 .NET 软件(可以跨防火墙)进行远程配置,我正在考虑使用 WCF。 到目前为止,我对 WCF 只了解一点点,但我了解到它应该可以与 .NET 以外的环境进行互操作。 嵌入式环境具有 HTTP 堆栈,但没有对 Web 服务的内置支持。 有谁有此类事情的经验或知道它是否合适? 如果是这样,请提供一些建议或为我指出正确的方向。
谢谢!
I am working on a project that involves an embedded system which runs a non-microsoft OS with a C program for the application and am developing .NET software for its end user applications. For remote configuring with the .NET software (which can go across firewalls), I am considering using WCF. I know only a little about WCF so far but I've read that it is supposed to be interoperable with environments other than .NET. The embedded environment has an HTTP stack but no built in support for web services. Does anyone have any experience with this kind of thing or know if it would be appropriate at all? If so please provide some advice or point me in the right direction.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
WCF 是可互操作的,因为它是通过 HTTP 访问的。 Visual Studio 可以帮助您非常快速地为 WCF 构建客户端库,但客户端对 WCF 的访问除了具有适当负载的 HTTP 调用外不需要任何其他内容。 如果您正在查看远程服务器调用,并且嵌入式环境中的内置支持是基本 HTTP,请考虑将服务器端构建为 REST 格式的方法。 您的调试器会感谢您的。
WCF is interoperable because it's accessed over HTTP. Visual Studio can help you build client libraries very quickly for WCF, but client access to WCF doesn't require anything other than HTTP calls with the proper payload. If you're looking at a remote server call and your built-in support in your embedded environment is basic HTTP, look at building your server-side as REST-formatted methods. Your debugger will thank you.
您计划来回传输哪些类型的数据? 对于这种低级别和专有的东西,我建议坚持使用好的老式套接字。
What kinds of data are you planning on transferring back and forth? For something this low level and proprietary I would recommend sticking with good old fashioned Sockets.
我将来回传递配置数据......基本上是为了使技术支持人员能够远程对设备进行编程。 如果我使用套接字,这可能是二进制数据,但要求使用防火墙的客户不需要打开任何端口。 因此,我正在考虑通过 HTTP 发送 XML。 那么,在服务器端使用WCF还是REST更好呢? 或者 WCF 与 REST?
I will be passing configuration data back and forth...basically to enable technical support staff to remotely program the device. If I were using sockets this could be binary data, but there is a requirement that customers with firewalls shouldn't need to open any ports. Because of this I was thinking of sending XML over HTTP. So, is it better to use WCF or REST on the server side? Or WCF with REST?
我很好奇您的“具有防火墙的客户”要求。 带有二进制数据或基于 HTTP 的 XML 的套接字可以使用任何端口(不仅仅是端口 80),我很好奇您的设备是否会“侦听”网络,或者只是建立出站连接。 如果您的设备正在侦听,您将需要在防火墙上打开一个端口。 在防火墙上建立出站连接(“打电话回家”)要容易得多。
所以我认为你可以使用套接字和二进制数据。 然而,我在过去的两个项目中遇到了类似的问题,我真的很想在嵌入式设备上使用 REST 实现 WCF,但没有其他人愿意这样做 - 我希望其他人会是第一个,并发布一些结果!
祝你好运! (并发布你的结果!)
I'm curious about your "customers with firewalls" requirement. Sockets with binary data or XML over HTTP can use any port (not just port 80), and I'm curious if your device will be "listening" on the network, or just making an outbound connection. If your device is listening, you will need to open a port on the firewall. Making an outbound connection ("phoning home") is much easier on the firewall.
So I think you could use sockets and binary data. However, I have faced similar issues on the last two projects, and I really wanted to implement WCF using REST on the embedded device, but no one else wanted to do it - I'm hoping someone else will be first, and publish some results!
Good Luck! (and post your results!)