2012-02-25 65 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(); 
} 

回答

相關問題