【问题标题】:WCF service using duplex channel in different domains在不同域中使用双工通道的 WCF 服务
【发布时间】:2009-04-22 15:38:56
【问题描述】:

我有一个 WCF 服务和一个 Windows 客户端。它们通过双工 WCF 通道进行通信,当我从单个网络域中运行时,该通道运行良好,但是当我将服务器放在单独的网络域上时,我在 WCF 服务器跟踪中收到以下消息...

带有to的消息

'net.tcp://abc:8731/ActiveAreaService/mex/mex' 无法在接收方处理, 由于 AddressFilter 不匹配 端点调度程序。检查 发送者和接收者的 EndpointAddresses 同意。

因此,如果组件位于两个单独的域中,则通信似乎只能在一个方向(从客户端到服务器)进行。

网络域是完全受信任的,所以我有点困惑,还有什么可能导致这种情况?

服务器 app.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="JobController.ActiveAreaBehavior">
                    <serviceMetadata httpGetEnabled="false" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <service behaviorConfiguration="JobController.ActiveAreaBehavior"
                     name="JobController.ActiveAreaServer">
                <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" />
                <host>
                    <baseAddresses>
                        <add baseAddress="net.tcp://SERVER:8731/ActiveAreaService/" />
                    </baseAddresses>
                </host>
            </service>
        </services>
    </system.serviceModel>

</configuration>

但我也在 Visual C++ 中以编程方式添加了一个端点

host = gcnew ServiceHost(ActiveAreaServer::typeid);

NetTcpBinding^ binding = gcnew NetTcpBinding();
binding->MaxBufferSize = Int32::MaxValue;
binding->MaxReceivedMessageSize = Int32::MaxValue;
binding->ReceiveTimeout = TimeSpan::MaxValue;

binding->Security->Mode = SecurityMode::Transport;
binding->Security->Transport->ClientCredentialType = TcpClientCredentialType::Windows;

ServiceEndpoint^ ep = host->AddServiceEndpoint(IActiveAreaServer::typeid, binding, String::Empty); // Use the base address

客户端 app.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <netTcpBinding>
                <binding name="NetTcpBinding_IActiveAreaServer" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                    hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                    maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
                    maxReceivedMessageSize="65536">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="Transport">
                        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                        <message clientCredentialType="Windows" />
                    </security>
                </binding>
            </netTcpBinding>
        </bindings>
        <client>
            <endpoint address="net.tcp://SERVER:8731/ActiveAreaService/"
                binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IActiveAreaServer"
                contract="ActiveArea.IActiveAreaServer" name="NetTcpBinding_IActiveAreaServer">
                <identity>
                    <userPrincipalName value="user@SERVERDOMIAIN.CLIENTDOMAIN.COM" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

感谢任何帮助!

干杯

【问题讨论】:

    标签: .net wcf


    【解决方案1】:

    如果我没记错的话,回调通道实际上发生在某种愚蠢的地方,比如端口 80。看看你选择的地址,我敢打赌你的两台机器之间有防火墙,并且你已经明确打开了一个端口.您可能必须打开端口 80。

    如果端口 80 不是您的理想之选,我认为您可以使用正在使用的绑定的 clientBaseAddress 属性进行配置。

    让我们知道事情的进展。

    【讨论】:

      【解决方案2】:

      这实际上是我的一位同事发布的问题,奇怪的是我知道不问,我检查了用于回调通道的端口,它们似乎是在一定范围内随机生成的。到目前为止,我已经看到了 3501、4595 和其他一些,所以我已经排除了端口的问题..

      还有其他想法吗?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-02-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-12-17
        相关资源
        最近更新 更多