【发布时间】:2012-03-15 13:40:17
【问题描述】:
我正在尝试通过 net.msmq 托管 WCF 服务。
下面的代码给了我“通信对象 System.ServiceModel.ServiceHost,不能用于通信,因为它处于故障状态。”这是为什么?它适用于 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();
}
【问题讨论】: