很抱歉这些愚蠢的问题,但是关于 WCF 的一些事情我无法理解。对于以下内容的一些建议将非常有用......
很抱歉问题转储,但很高兴知道我是否以正确的方式思考 WCF 的工作方式。
谢谢。
最佳答案
At a very basic level is it correct that WCF uses either Binary (Net.Tcp), HTTP or MSMQ to transfer my message on the wire?
您将传输层与序列化机制混淆了。 WCF transports选项包括 TCP、命名管道、HTTP 和 MSMQ。 WCF serialisation选项是二进制、文本(包括 SOAP、POX 和 JSON)和 MTOM。
However is it true that in all cases, regardless of how the data is transferred the message itself in in the SOAP format with headers and a body? So its a sort of XML message that is transmitted in either HTTP/S or in a binary format.
否。WCF 使用 Message类作为通信的原子单元。它在结构上类似于 SOAP,但不是像 SOAP 那样的序列化格式。
Is Net.Tcp a good choice for my client server app - its similar to a messenger app in that the clients are all remote users on the other side of the firewall to my server. Most things I am reading are telling to use WS* and HTTP.
听起来 TCP 不是一个好的选择。除非您能够在端口 80 或 443 上操作服务器,否则防火墙可能会使 TCP 变得困难。根据我个人的经验,我还建议不要在 Internet 部署中使用带有 TCP 绑定(bind)的 WCF。当 TCP 连接丢失时,WCF 会让您跳过很多圈来捕获并重新建立它。 HTTP 绑定(bind)更容易管理。
Is Net.Tcp secured by standard and without certificates? - that is - people cannot listen on the wire and decode the data thats going to and from.
NetTCP binding is secured by default with TLS .
Is it possible to send a username and password using net.tcp and without an installed certificate?
您可以使用预安装的证书通过 TCP 绑定(bind)进行身份验证。您还可以在邮件标题中添加用户名和密码,但这是另一回事。
If so I presume I can hook this up to my membership provider and authenticate access to each method on my service contract implementation.
您可以使用 OperationContext 提取消息头。并提取您喜欢的任何信息并将其与您的身份验证提供程序一起使用。
I presume that with username and password security, the proxy is initialised with the username and password and that this information is is sent with every request.
和
Then my membership provider will be invoked for each method call and do whatever it needs to do to get the authorisation for the method.
听起来你想看看How to: Use the ASP.NET Membership Provider .
关于WCF net.tcp 绑定(bind)、消息格式和安全问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2441775/