Best way to speak to WCF windows service from other PCs and Unix?
Hi I want to create a windows service that speaks to a low speed peic开发者_开发技巧e of USB hardware connected to a desktop PC.
I would like the windows service's methods to be callable from other software on that PC, and other PCs/ Unix clients on the LAN.
Given the low speed nature of the data (just occasional staus requests of progress of the USB device ) - does it make sense to use a default http WCF binding for this or should I be looking at TCP binding or sockets for this?
Many Thanks
maybe you can create an httplistener and intercept request to it to send or receive data.
the power of this solution is that http is nearly universal and any other computer will be able to send request to your service.
[edit] or you can use a restful wcf service for the same reason (but clients will have to deal with xml)
I would go for a net tcp binding, as it's designed and optimzed for cross-machine communications, with binary message encoding. http would be more flexable and cross client assessable. you could even call your services with no special client setup.
Why limit yourself to one binding? You can easily expose multiple endpoints, a NetTcp endpoint for other windows clients on the LAN (which are faster than communicating via the HTTP protocol); a BasicHttp endpoint for non-windows clients on the network; for other services on the same machine you can even expose a NamedPipes endpoints which even beats NetTcp on speed. That's the beauty of WCF! Build the service once and expose however you want :-D
Mind you though, if you choose to host your service with IIS7 it wouldn't make any performance difference whether you use NamedPipes/NetTcp/BasicHttp endpoints as everything have to go through HTTP anyway.
精彩评论