gpt4 book ai didi

.net - IIS7.5 上托管的 WCF netTcpBinding 停止工作

转载 作者:行者123 更新时间:2023-12-05 00:03:34 25 4
gpt4 key购买 nike

我有一个简单的 .NET 4 WCF 服务,我在 IIS7.5 上本地托管。最初我使用 httpBinding 托管它效果很好。然后我把它切换到netTcpBinding , 在更改 web.config 之后因此,文件也可以正常工作。但是今天它决定停止工作。我根本无法使用测试客户端连接到服务,得到:
URI: net.tcp://localhost/case/service.svc/mex Metadata contains a reference that cannot be resolved: 'net.tcp://localhost/case/service.svc/mex'. The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost/case/service.svc/mex' is unavailable for the protocol of the address.
我检查了(仍然)安装了非http激活服务; net tcp 监听服务正在运行; net.tcp 在站点的启用协议(protocol)列表中;我已经运行了servicemodelreg.exe -ia ;我也重新运行了aspnet_regiis.exe -i ;最后我检查了网站上的 net.tcp 绑定(bind)。

如果我运行 netstat我可以看到端口上正在监听某些东西,但我无法连接到它。

这让我发疯,因为今天早上它工作得很好(就像上周一样),但现在不是了。

编辑:如果我在 IE 中访问该服务,那么我可以看到它引发了以下异常:

Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].

但是查看 web.config似乎不是这种情况的文件:
<services>
<service behaviorConfiguration="ServiceBehavior" name="[REMOVED].[REMOVED]">
<endpoint binding="netTcpBinding" bindingConfiguration="PortSharingBinding" contract="[REMOVED].[REMOVED]" />
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
</service>
</services>

<bindings>
<netTcpBinding>
<binding name="PortSharingBinding" portSharingEnabled="true">
<security mode="None"/>
</binding>
<binding name="mexTcpBinding" portSharingEnabled="true">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>

最佳答案

好的,终于解决了。我在站点级别启用了 net.tcp 协议(protocol),但在应用程序级别没有启用它。我想它一定是以前,我想我可能会在之前更改项目名称后创建一个新应用程序,显然忘记在应用程序上设置协议(protocol) - 哦!

因此,在 IIS 上托管 WCF net.tcp 服务的最终 list 是:

  • 确保安装了 WCF 非 HTTP 激活服务
  • 确保 Net.Tcp Listener服务和Net.Tcp Port Sharing服务都在运行
  • 将 net.tcp 添加到站点和应用程序的启用协议(protocol)(要从 IIS 管理器访问高级设置选项,您必须有一个 http 绑定(bind))
  • 运行servicemodelreg.exe -ia向 IIS 注册 WCF 元素
  • 运行aspnet_regiis.exe -i确保使用 IIS 正确设置 .NET
  • 将 net.tcp 绑定(bind)添加到站点
  • 关于.net - IIS7.5 上托管的 WCF netTcpBinding 停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6898883/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com