无法访问具有net.tcp绑定的IIS托管WCF服务
我正在尝试在Windows 7上的IIS 7.5站点中托管具有net.tcp绑定的WCF服务,64位。遗憾的是,该服务无法访问。事实上,使用telnet打开到TCP端口的连接甚至会失败 以下是网站web.config的my system.serviceModel部分的内容:无法访问具有net.tcp绑定的IIS托管WCF服务,wcf,.net-4.0,iis-7.5,net.tcp,Wcf,.net 4.0,Iis 7.5,Net.tcp,我正在尝试在Windows 7上的IIS 7.5站点中托管具有net.tcp绑定的WCF服务,64位。遗憾的是,该服务无法访问。事实上,使用telnet打开到TCP端口的连接甚至会失败 以下是网站web.config的my system.serviceModel部分的内容: <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="Defa
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultServiceBehavior">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="2000000" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="DefaultServiceBehavior"
name="FooService">
<endpoint binding="netTcpBinding" bindingConfiguration="service"
name="service" contract="IFoo" />
<endpoint binding="mexTcpBinding"
bindingConfiguration="DuplexBinding" contract="IFoo" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://127.0.0.1:9000/service"/>
</baseAddresses>
</host>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="service" portSharingEnabled="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384" maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<security mode="None"/>
</binding>
<binding name="DuplexBinding">
<reliableSession enabled="true"/>
<security mode="None"/>
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
因此,“注册基址方案”一词让我担心;为了让我的站点支持net.tcp方案,我还需要做些什么吗?看起来您已经正确地完成了大部分工作
剩下的最可能的问题是防火墙。标准windows防火墙正在阻止端口9000。我将尝试SSamra的建议。我认为您的基本地址和您尝试的URL可能是错误的。我的看起来像这样:
净。tcp://localhost:PORT/ServiceNamespace/ClassName.我终于让IIS允许连接到端口9000。我以前没有看到这个选项,但我不知道这是因为我没有通过抽查,还是因为我必须做些什么才能让它出现
在IIS站点的高级设置下,有一个“启用的协议”设置。以前,它被设置为仅
http
。将其更改为http,net.tcp后,我可以连接到tcp端口。由于您使用的是IIS,我将完全删除baseAddress节点,因为IIS将根据您配置的绑定/虚拟路径推断基址
还请记住,如果没有任何http端点可用,WCF不会对元数据行为中的
httpGetEnabled=“true”
属性感到高兴。我已经为TCP端口9000的Windows 7防火墙创建了入站规则,但连接仍然失败。我还需要做些什么来绕过防火墙吗?@Jacob-您可以暂时禁用防火墙,以100%确定它不是windows防火墙。不幸的是,禁用防火墙在我的环境中是不允许的。我想我在问题中添加的错误消息可能有助于解决问题。您正在从客户端尝试什么URL?我已经尝试了net。tcp://127.0.0.1:9000/service
和其他变体,但我想如果我甚至无法建立到端口9000的连接,我的问题不在于URL.try.net。tcp://127.0.0.1:9000/service/service
<baseAddresses>
<add baseAddress="net.tcp://localhost:9000/"/>
<add baseAddress="http://localhost:8050/"/>
</baseAddresses>