我是 WCF 和 IIS 的新手,但一直在阅读有关如何在 IIS 中托管 WCF 应用程序的文章。我们有一个系统正在尝试部署到 IIS,该系统需要 HTTP 和 NET.TCP 端点。我已经按照随机教程中看到的方式配置了所有内容,但仍然无法从客户端连接。任何有关配置的帮助将不胜感激!
我的 WCF 目录中的 EdWCF.svc 文件:
< %@ ServiceHost Language="C#" Debug="true" Service="TwoFour.WCF.Engine.EdWCF" % >
我的网络配置:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyBehaviour">
<serviceMetadata HttpGetEnabled="True" />
</behavior>
</serviceBehaviors>
</behaviors>
<service name="TwoFour.WCF.Engine.EdWCF" behaviorConfiguration="MyBehaviour">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:12345/WCF/EdWCF.svc"/>
</baseAddresses>
</host>
<endpoint address=""
binding="netTcpBinding"
bindingConfiguration="InsecureTcp"
contract="TwoFour.WCF.Interface.Shared.IEdWCF" />
<endpoint address="mexhttp" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
<bindings>
<netTcpBinding>
<binding name="InsecureTcp" portSharingEnabled="true">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
</configuration>
感谢您的任何帮助或建议!
在 IIS 中,将 net.tcp 绑定添加到启用的协议列表中(管理网站 -> 高级设置 -> 启用的协议)
在站点绑定中添加 net.tcp 绑定(编辑绑定 -> 添加 -> 选择类型为 net.tcp 并添加端口,如下所示 12345:*)
您还需要在配置中指定基址:
<system.serviceModel>
<services>
<host>
<baseAddresses>
<add baseAddress="net.tcp://server:12345/ServiceAddress.svc"/>
</baseAddresses>
</host>
...
</service>
...
</system.serviceModel>
Edit:
Try this
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyBehaviour">
<serviceMetadata />
</behavior>
</serviceBehaviors>
</behaviors>
<service name="TwoFour.WCF.Engine.EdWCF" behaviorConfiguration="MyBehaviour">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:12345/WCF/EdWCF.svc"/>
</baseAddresses>
</host>
<endpoint address=""
binding="netTcpBinding"
bindingConfiguration="InsecureTcp"
contract="TwoFour.WCF.Interface.Shared.IEdWCF" />
<endpoint address="mextcp" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
<bindings>
<netTcpBinding>
<binding name="InsecureTcp" portSharingEnabled="true">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
</system.serviceModel>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)