【发布时间】:2012-05-24 19:15:28
【问题描述】:
我正在尝试让我的 WCF 服务使用 netTcpBinding 而不是 wsHttpBinding,但我似乎无法让它工作。
我将net.tcp 绑定添加到 IIS7.5,但状态为未知(当我还删除 http 绑定时,它会在站点中放置一个大红色 X,我必须先添加一个新的 http 绑定我可以再次访问任何设置)。我已经看过这里和谷歌,但我只能找到两三个关于这个问题的帖子,没有任何真正的解决方案。
我有什么:
- WAS 服务正在运行,还有 Net.* 服务。
- 在 IIS 的高级设置中添加了 net.tcp。
- 已安装 WCF 非 http。
似乎有一个 TCP 侦听器正在运行,因为它在 netstat 中显示它正在侦听我指定的端口:809)并且我还收到了防火墙消息(也尝试禁用防火墙/防病毒,但它没有'帮助)。
WCF 测试客户端导致此错误:
错误:无法从 net.tcp://localhost:809/MyService.svc 获取元数据
我的 Web.config(主要从 MSDN 复制,正确的布局请看这里http://pastebin.com/Ru8p0T9N):
<services>
<service behaviorConfiguration="MyBehavior" name="WCFService.MyService">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="Binding1" name="MyServiceEndpoint" contract="WCFService.MyService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" name="MyServiceMexTcpBidingEndpoint" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:809/MyService.svc" />
</baseAddresses>
</host>
</service>
</services>
<behavior name="MyBehavior">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<netTcpBinding>
<binding name="Binding1"hostNameComparisonMode="StrongWildcard"sendTimeout="00:10:00"maxReceivedMessageSize="65536"transferMode="Buffered"portSharingEnabled="true">
<security mode="Message">
<transport clientCredentialType="None" />
<message clientCredentialType="None" />
</security>
</binding>
</netTcpBinding>
wsHttpBinding 一切正常,但net.tcp 不行。我在多个来源的 Web.config 中尝试了几种不同的设置,但最终还是遇到了同样的问题。
【问题讨论】:
-
您是否验证了以下文章中的所有问题:codegain.com/articles/wcf/howto/…
-
感谢您的链接,我将应用程序池设置为经典模式(之前没有),但仍然是同样的错误。
标签: c# wcf iis service net.tcp