问题描述
我有一个 WCF 服务在带有 ServiceHostFactory 的 IIS 上运行.它使用 WSHttpBinding 运行良好,但由于速度和所有内容都在同一网络(无防火墙)上,我想使用 NetTcpBinding 来加快速度.
I have a WCF service running on the IIS with a ServiceHostFactory. It's running fine with the WSHttpBinding but because of the speed and everything being on the same network (no firewalls) i want to speed up things a bit using the NetTcpBinding instead.
当我尝试这样做时,我收到此错误:
When i try to do that i get this error:
无法连接到 net.tcp://zzz.xxx.yyy/MyService.svc.连接尝试持续了 00:00:01.0464395 的时间跨度.TCP 错误代码 10061:无法建立连接,因为目标机器主动拒绝 x.x.x.x:808.
我正在使用 SecurityMode.None
只是为了确保这不会让我感到困惑,我也尝试了两次不同的尝试:
I'm using SecurityMode.None
just to make sure that is not screwing me also i tried either of these on two different tries:
binding.Security.Message.ClientCredentialType = MessageCredentialType.None;
binding.Security.Message.ClientCredentialType = TcpClientCredentialType.Windows;,
我还应该指出,我从其中一个服务调用中提取了相当多的数据,所以我也将这些数据(包括 http 和 tcp 尝试 - 将 maxMessageSize 设置为 1000000)
Also i should point out, that i'm pulling quite a lof of data from one of the service calls, so i also put these (both on the http and the tcp attempts - setting maxMessageSize to 1000000)
binding.MaxReceivedMessageSize = maxMessageSize;
binding.ReaderQuotas.MaxArrayLength = maxMessageSize;
让它工作应该很容易,所以我错过了什么?
It should be pretty easy getting it to work, so what am I missing?
更新:我将 TCP 端口 808 添加到网站标识并再次尝试.现在我收到此错误:
UPDATE: I added the TCP port 808 to the website identity and tried again. Now i get this error:
您尝试为不支持 .Net 框架的服务创建通道.您可能遇到了 HTTP 端点.
推荐答案
查看 这篇关于在 IIS 7.0 中启用非 HTTP 绑定的帖子.默认情况下,您必须在 IIS 7.0 中显式启用 net.tcp.
Check out this post on enabling non-HTTP bindings in IIS 7.0. By default, you have to explicitly enable net.tcp in IIS 7.0.
希望这会有所帮助.
更新:
看到您的评论 - 不幸的是,IIS 6.0 不支持 net.tcp.查看此链接,其中详细介绍了各种主机支持的 WCF 绑定(包括自托管、WAS 和 IIS).看起来只有 HTTP 绑定在 IIS 6.0 中有效.
Saw your comment - unfortunately, net.tcp is not supported in IIS 6.0. Check out this link which details the supported WCF bindings for various hosts (including self-hosting, WAS, and IIS). Looks like only HTTP bindings work in IIS 6.0.
这篇关于为什么我不能使用 net.tcp 连接到 WCF 服务,但我可以使用 http?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!