2013-01-05 87 views
0

我正在编写一个包含Windows RT(Windows应用商店应用程序)的移动应用程序的WCF解决方案。远程调试WCF客户端应用程序 - 无法连接到主机

移动应用程序工作正常,当我从开发机器运行WCF主机运行在同一台机器上。我试图通过远程调试在我的MS Surface RT上进行测试。这开始工作。该应用程序并开始在表面上,但只要我做了什么,需要它来访问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上ping相同的IP地址,所以我知道它可以看到开发机器。

再说一次,当移动应用程序与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(); 

还有什么问题呢?

回答

0

您是否在应用程序清单中启用了Private Networks (Client & Server)功能?

<Capabilities> 
    <Capability Name="privateNetworkClientServer" /> 
</Capabilities> 
+0

谢谢。这可能是。我没有启用。我本周不在这个城市,没有专门的网络来测试它,但我会在下周末测试它,并告诉你它是否有效。 – JoeMjr2

+0

好吧,我想出了如何在笔记本电脑上创建一个私人托管的无线网络。添加privateNetworkClientServer功能的工作!谢谢! – JoeMjr2

相关问题