2

Windows 7 で WCF REST および TCP (役割間) エンドポイントを使用してプロジェクトを開発していました。Windows 8 にアップグレードしたばかりで、深刻な問題が発生しています。

まず、プロジェクトを azure にデプロイすると、次の警告が表示されます。

Windows Azure Tools: Warning: Remapping private port 80 to 81 in role 'OfisimCRM.WebClient' to avoid conflict during emulation.

Windows Azure Tools: Warning: Remapping private port 443 to 446 in role 'OfisimCRM.WebClient' to avoid conflict during emulation.

Skype は無効になっており、問題ではありません。

これはそれほど重要ではありませんが、重要なことは、ファイアウォールを完全に無効にしたにもかかわらず、役割間通信要求からより深刻なエラーが発生することです。ここにあります:

Could not connect to net.tcp://127.255.0.0:22000/NotifyService. The connection attempt lasted for a time span of 00:00:01.1820716. TCP error code 10061: No connection could be made because the target machine actively refused it 127.255.0.0:22000.  - 
Server stack trace: 
   at System.ServiceModel.Channels.SocketConnectionInitiator.Connect(Uri uri, TimeSpan timeout)
   at System.ServiceModel.Channels.BufferedConnectionInitiator.Connect(Uri uri, TimeSpan timeout)
   at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
   at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
   at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

TCP クライアント コード:

public static LicenseItem CheckLicense(int userID)
{
    // This instance does not exist in memory cache. Check if other servers in the same web role know anything about this instance.
    var webRoles = RoleEnvironment.Roles["OfisimCRM.WebClient"];
    var myID = RoleEnvironment.CurrentRoleInstance.Id;
    LicenseItem remoteValue = null;
    foreach (var targetInstance in webRoles.Instances)
    {
        // I am currently going through a loop of instances. Check if the current enumaration shows my address.
        if (targetInstance.Id == myID)
        {
            // Skip.
        }
        else
        {
            // This is a neighbour instance. Check to see if it knows about the instance I'm looking for.
            NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);

            EndpointAddress targetAddress = new EndpointAddress(
                String.Format("net.tcp://{0}/NotifyService", targetInstance.InstanceEndpoints["NotificationServiceEndPoint"].IPEndpoint)
                );

            ChannelFactory<INotifyService> channelFactory = new ChannelFactory<INotifyService>(binding, targetAddress);
            INotifyService targetClient = channelFactory.CreateChannel();

            try
            {
                remoteValue = targetClient.CheckLicense(userID);
                if (channelFactory.State != System.ServiceModel.CommunicationState.Faulted)
                {
                    channelFactory.Close();
                }
            }
            catch (TimeoutException timeoutException)
            {
                Trace.TraceError("Unable to check license on web role instance '{0}'. The service operation timed out. {1}", myID, timeoutException.Message);
                ((ICommunicationObject)targetClient).Abort();
            }
            catch (CommunicationException communicationException)
            {
                Trace.TraceError("Unable to check instance on web role instance '{0}'. There was a communication problem. {1} - {2}", myID, communicationException.Message, communicationException.StackTrace);
                ((ICommunicationObject)targetClient).Abort();
            }
        }
    }
    return remoteValue;
}

編集 1: 重要な更新:

IIS の状態

問題は2番目のインスタンスについてだと思います。デバッグを行ったところ、この停止したインスタンスによってのみ接続が拒否されたことがわかりました。これですべてが説明できると思いますが、なぜそれが起こっているのかわかりません。

編集2:一時的な解決策:

Azure SDK June 2012 SP1 を Fall 2012 にアップグレードしたため、これは Windows 8 に関する問題ではないことに気付きました。プロジェクトのアップグレードされていないバージョンを TFS からダウンロードしましたが、動作していることがわかりました。結論として、それは Azure SDK ですが、その理由はわかりません。

4

2 に答える 2

2

ポート番号の再マッピングは、問題の兆候ではありません。これは正常な動作であり、常にそうです。Windows 8 Dev Boxの実行/構成中に、「Windows機能」WCFアクティベーションをインストールしましたか:

WCF アクティベーション

サービスが実際に稼働しているかどうかをテストする別の方法は、次のとおりです。

  • コンピューティング エミュレーターを起動し、ローカル デプロイを想定して、エンドポイントがあることを確認します。
  • 提供された IP とポート番号で telnet を実行して、実際に接続を確立できるかどうかを確認します

エンドポイント UI を確認します。

エンドポイント UI

これにより、入力エンドポイントが表示されます。そして、私が見るところ、あなたは内部エンドポイントを使用しています。試しに、Input に変更してみて、動作に変化があるかどうかを確認してください。

ただし、最初に WCF Activation がインストールされていることを確認してください。

于 2012-11-07T19:34:56.287 に答える
0

開発ボックスの IIS (フル IIS) で既定の Web サイトのバインドを解除するのを忘れると、常にこの問題が発生します。そうすることを覚えていましたか?デフォルトでは、ローカル IIS は http を「デフォルト Web サイト」のポート 80 にバインドします。そのバインディングを (inetmgr を使用して) 別のポートに編集すると、エミュレーターは 80 を取得できます。

于 2012-11-07T22:40:44.950 に答える