类似于Visual Studio开发Web服务器(Cassini)的局限性,即它仅在localhost上运行,我有WCF Service实现,仅在localhost上需要.
Similar to the Visual Studio development web server (Cassini) limitation that it only servers on localhost, I have a WCF Service implementation that is only needed on localhost.
除了Windows防火墙提示允许程序在面向外部的NIC上侦听之外,我不介意其他计算机可以访问.由于这仅是内部所需,因此我宁愿限制WCF服务器端配置,以免触发防火墙检测器.
I wouldn't mind other machines having access, except that the Windows Firewall prompts to allow the program to listen on the externally-facing NIC. Since this is only needed internally, I would rather restrict the WCF Server-side configuration so that it doesn't trip the firewall detector.
binding.HostNameComparisonMode = HostNameComparisonMode.Exact是正确的解决方案吗?我不知道这怎么够.
Is binding.HostNameComparisonMode = HostNameComparisonMode.Exact the right solution? I don't see how this is enough.
====
像Cassini一样,此Service实现是其他需要网络通信的替代品.可以将客户端配置为连接到真实服务器或在localhost上运行的虚假实现.
Like Cassini, this Service implementation is a stand-in for something else which DOES require network communication. The client can be configured to connect to the real server or the fake implementation running on localhost.
推荐答案这取决于您如何托管它.如果您使用的是IIS7或WAS,则WCF使用IIS的匹配模式.否则,如果使用HostNameComparisonMode.Exact,则是,主机名将始终是匹配的关键因素.如果主机名不匹配,则发送通常会失败.
It depends on how you are hosting it. If you are in IIS7 or WAS, then WCF uses IIS's mode of matching. Otherwise, if you use HostNameComparisonMode.Exact, then yes, the host name will always be a critical factor in matching. If the host name does not match, dispatch will generally fail.
应注意,精确并不是100%完全精确...它仍然允许主机名有所不同.如果您同时具有NetBios主机名和完整的DNS名称,则匹配仍然会发生,因为WCF将这两个视为相同.
It should be noted that exact is not 100% perfectly exact...it still allows some variation in the host name. If you have both a NetBios host name and a full DNS name, matching will still occur, as WCF treats those two as one and the same.
System.ServiceModel.BasicHttpBinding.HostNameComparisonmode
更多推荐
将WCF配置为仅LOCALHOST侦听
发布评论