2012-02-25 58 views
0

我想通过net.msmq托管一个WCF服务。为什么不能以这种方式使用WCF中的net.msmq绑定?

以下代码给我“通信对象System.ServiceModel.ServiceHost不能用于通信,因为它处于Faulted状态。”“为什么会这样?它适用于net.tcp和http,所以我假设它也应该为msmq工作。

我已经创建了一个名为“HelloIndigo”的私人消息队列。

using (ServiceHost host = new ServiceHost(typeof(HelloIndigoService), 
        new Uri("net.msmq://localhost/private/HelloIndigo"))) 
{ 
    host.AddServiceEndpoint(typeof(IHelloIndigoService), 
          new NetMsmqBinding(), "HelloIndigoService"); 
    host.Open(); 
    Console.WriteLine("Press <Enter> to terminiate the service host."); 
    Console.ReadLine(); 
} 

回答

相关问题