c# - IIS8 没有端点监听 net.tcp :

标签 c# wcf net.tcp iis-8

我在 IIS8 中有一个 WCF 服务主机,我想使用 net.tcp 绑定(bind)。

我有这样的配置:

网络配置:

<service behaviorConfiguration="MyBehavior"
  name="DecryptService.EmailCenterDecryptTCP">
    <host>
      <baseAddresses>
        <add baseAddress="net.tcp://XX.XX.XX.XX:808/VirtualFolder/Service.svc" />
      </baseAddresses>
    </host>

    <endpoint address=""
          binding="netTcpBinding"
          bindingConfiguration="portSharingBinding"
          name="MyServiceEndpoint"
          contract="ServiceNamespace.IService">
    </endpoint>

    <endpoint address="mextcp"
          binding="mexHttpBinding"
          bindingConfiguration=""
          name="MyServiceMexTcpBidingEndpoint"
          contract="IMetadataExchange" />
</service>

当我尝试在具有以下配置的 IIS8 所在的同一台机器上使用该服务时工作正常:

<client>
        <endpoint address="net.tcp://YY.YY.YY.YY:808/VirtualFolder/Service.svc"
            binding="netTcpBinding" bindingConfiguration="MyServiceEndpoint"
            contract="ServiceReference1.IService" name="MyServiceEndpoint" />
    </client>

YY.YY.YY.YY 是机器的本地 IP,但是当我尝试在另一台机器上使用服务时,将 YY.YY.YY.YY 更改为机器的外部 IP (ZZ.ZZ.ZZ.ZZ)运行 IIS8 我收到以下错误:

There was no endpoint listening at net.tcp://ZZ.ZZ.ZZ.ZZ/VirtualFolder/Service.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

有什么想法吗? 谢谢,对不起我的英语不好

编辑:

我制作了一个运行 ServiceHost 的控制台应用程序来替换 IIS,并且使用此配置它可以在 Internet 上运行

var svh = new ServiceHost(typeof (Service));
svh.AddServiceEndpoint(typeof (ServiceNamespace.IService), new NetTcpBinding(SecurityMode.None), "net.tcp://serverLocalIp:808");
svh.Open();

Console.WriteLine("SERVER - Running...");
stopFlag.WaitOne();

Console.WriteLine("SERVER - Shutting down...");
svh.Close();

Console.WriteLine("SERVER - Shut down!");

知道 IIS 在 Internet 上运行相同的服务有什么问题吗?在本地工作。 谢谢

最佳答案

您还需要设置 IIS 以接收 Net.TCP 连接。

在您的 IIS 应用程序的 Advanced Settings 下,然后在 Enabled Protocols 下确保您有 http,net.tcp 请注意没有空间,如果你有空间,它将失败。

http://blogs.msdn.com/b/swiss_dpe_team/archive/2008/02/08/iis-7-support-for-non-http-protocols.aspx

关于c# - IIS8 没有端点监听 net.tcp :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15838921/

相关文章:

c# - 使用 Mutex 'using' 时 Try-Finally-Release 是否多余?

c# - 在 C# 中使用 File.Copy() 时“设备未准备好”

c# - 使用 Entity Framework 从 2 个表返回数据

linux - 使用 net.tcp 绑定(bind)时 MONO 返回连接被拒绝

c#-4.0 - WCF : Multiple bindings on TCP. 网络

c# - WCF HttpTransport : streamed vs buffered TransferMode

wcf - 在 IIS 上运行 .net 4 WCF 服务时出现 404(无 svc 文件)

c# - WCF web.config 中的 readerQuotas 与请求限制

c# - 在 WCF 中支持具有属性的 XSD

c# - 服务器已拒绝客户端凭据,WCF 作为 Windows 服务