Ira*_*ney 4 .net iis wcf net.tcp
我有一个简单的.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 listener服务正在运行; net.tcp位于站点的已启用协议列表中; 我跑了servicemodelreg.exe -ia; 我也重新跑了aspnet_regiis.exe -i; 最后我检查了网站上的net.tcp绑定.
如果我运行,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].
Run Code Online (Sandbox Code Playgroud)
但查看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>
Run Code Online (Sandbox Code Playgroud)
好的,终于解决了.我在站点级别启用了net.tcp协议,但是在应用程序级别没有启用它.我想它一定是以前的,我想我可能在更改项目名称之前创建了一个新的应用程序,显然忘了在应用程序上设置协议 - doh!
因此,在IIS上托管WCF net.tcp服务的最终清单是:
Net.Tcp Listener服务和Net.Tcp Port Sharing服务都在运行servicemodelreg.exe -ia以使用IIS注册WCF元素aspnet_regiis.exe -i以确保使用IIS正确设置.NET| 归档时间: |
|
| 查看次数: |
3074 次 |
| 最近记录: |