簡體   English   中英

在不同域中使用雙工信道的WCF服務

[英]WCF service using duplex channel in different domains

我有WCF服務和Windows客戶端。 它們通過Duplex WCF通道進行通信,當我在單個網絡域中運行時,該通道運行良好,但是當我將服務器置於單獨的網絡域中時,在WCF服務器跟蹤中會收到以下消息...

與的訊息

由於EndpointDispatcher上的AddressFilter不匹配,因此無法在接收方處理'net.tcp:// abc:8731 / ActiveAreaService / mex / mex'。 檢查發送方和接收方的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>

任何幫助表示贊賞!

干杯

如果我沒記錯的話,回調通道實際上是在某種愚蠢的東西上發生的,例如端口80。考慮到您選擇的地址,我認為兩台計算機之間存在防火牆,並且您已明確打開了端口。 您可能必須打開端口80。

我認為如果端口80不是您可以使用的話,您可以使用綁定的clientBaseAddress屬性進行配置。

讓我們知道事情的發展。

這實際上是我的一位同事發布的問題,奇怪的是我不問,我已經檢查了用於回調通道的端口,它們似乎是在一定范圍內隨機生成的。 到目前為止,我已經看到3501、4595和其他一些端口,因此我已經排除了端口問題。

還有其他想法嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM