Help to choose a binding(WCF)

前端 未结 2 1004
予麋鹿
予麋鹿 2021-01-06 17:32

I need to create WCF Application, which will be working with pictures. It allows you to get a picture as a stream, and to send a picture to server (as a stream). It will wor

2条回答
  •  别那么骄傲
    2021-01-06 17:38

    Check out this blog post (or many other, similar ones)

    The diagram to choose the proper binding is from Juval Lowy's book Programming WCF Services and gives the best guidance, really:

    enter image description here

    Now your additional requirement of streaming limits the number of choices, obviously - net.msmq is out of the question, obviously.

    Streaming is supported by basicHttpBinding, netTcpBinding, and netNamedPipesBinding. The last one probably also is out of the question, since it work on the same machine only (client and server).

    So the choice really boils down to basicHttpBinding vs. netTcpBinding. basicHttp works over http connections and port 80, so it's well suited for internet and "open to the public" scenarios, while netTcp might be a tad faster, but it requires specific ports, which need to be open on server and/or firewalls - so it's probably better suited for corporate LAN environments, but not for the general internet per se.

    Other bindings might come into consideration in very specific scenarios, e.g. you might want to investigate the Relay bindings if you're moving into the cloud, and the Federation bindings if you're looking into federated security - but those don't really apply here when it comes to streaming.

提交回复
热议问题