管道已经结束。 (109,0x6d)在调试模式下

时间:2013-04-27 08:53:45

标签: wcf netnamedpipebinding

我使用的是wcf,客户端是

NetNamedPipeBinding binding = new NetNamedPipeBinding();
binding.TransferMode = TransferMode.Streamed;
binding.MaxBufferSize = 1000;
binding.MaxReceivedMessageSize = 67108864;
binding.ReaderQuotas.MaxStringContentLength = 1024000000;
binding.ReaderQuotas.MaxArrayLength = 1024000000;
string uriFormat = string.Format("net.pipe://localhost/Design_Time_Addresses/WcfServiceLibrary/Service1");

EndpointAddress address = new EndpointAddress(new Uri(uriFormat));

服务器端是

ServiceHost host = new ServiceHost(typeof(Service1));
try
  {
     host.Open();
     Console.WriteLine("service start.");
  }
catch(Exception ex)
{
     Console.WriteLine(ex.Message);
}
Console.ReadLine();   

 try
   {
      ChannelFactory<IService1> factory = new ChannelFactory<IService1>(binding, address);
      factory.Credentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
      IService1 service = factory.CreateChannel();
      string str = service.GetData(5);
      Console.WriteLine(str);
      Console.ReadLine();
   }
   catch (Exception ex)
   {
      string str = ex.Message;
   }

当客户端以非调试模式运行时它可以工作,但是当客户端以调试模式运行时,我收到错误“管道已经结束。(109,0x6d)”。

0 个答案:

没有答案