0

Windows RT 用のモバイル アプリ (Windows ストア アプリ) を含む WCF ソリューションを作成しています。

同じマシンで WCF ホストを実行して、開発マシンからモバイル アプリを実行すると、モバイル アプリは正常に動作します。リモートデバッグを介して、MS Surface RT でテストしようとしました。これは機能し始めます。アプリは Surface で起動しますが、WCF ホスト (開発マシンで実行されている) にアクセスする必要があることを行うとすぐに、次の例外が発生します。

System.ServiceModel.EndpointNotFoundException was unhandled
Message: An unhandled exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in mscorlib.dll
Additional information: There was no endpoint listening at http://192.168.0.101:8000/Service1 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

内部例外はありません。192.168.0.101 は、開発マシンの静的 IP です。

Windows ファイアウォールは開発マシンで無効になっており、他のファイアウォールはありません。Surface から同じ IP アドレスに ping を実行できるので、開発マシンを認識できることがわかります。

繰り返しますが、モバイル アプリが WCF ホストと共に開発マシンで実行されている場合、これは問題なく機能します。だから、私は問題が何であるか分かりません。

ホストでエンドポイントが作成されるコードは次のとおりです。

    ServiceHost hostA = null;

    try
    {
        hostA = new ServiceHost(typeof(Service1), new Uri("http://192.168.0.101:8000") );
        hostA.AddServiceEndpoint(typeof(IService1), new BasicHttpBinding(), "Service1");

        hostA.Open();

        Console.WriteLine();
        Console.WriteLine("Host started.  Press Enter to terminate host.");
        Console.ReadLine();

    }
    finally
    {
        if (hostA.State == CommunicationState.Faulted)
            hostA.Abort();
        else
            hostA.Close();
    }

そしてクライアントで:

    var myBinding = new BasicHttpBinding();
    var myEndpoint = new EndpointAddress("http://192.168.0.101:8000/Service1");
    var myChannelFactory = new ChannelFactory<ToOrson.IService1>(myBinding, myEndpoint);

    MyService = myChannelFactory.CreateChannel();

問題は何でしょうか?

4

1 に答える 1

0

Private Networks (Client & Server)アプリケーション マニフェストで機能を有効にしていますか?

<Capabilities>
    <Capability Name="privateNetworkClientServer" />
</Capabilities>
于 2013-01-07T20:19:23.597 に答える