简体   繁体   English

NamedPipeClientStream在app服务中不起作用

[英]NamedPipeClientStream not work in app service

my code work good in my server but in azure app service i get this error "The operation has timed out." 我的代码在我的服务器上运行良好但在azure应用程序服务中我收到此错误“操作已超时”。 in the line enter code here 在该行中enter code here

 pipeStream.Connect(TimeOut);

my code 我的代码

public void Send(string SendStr, string PipeName, int TimeOut = 1000)
    {
        try
        {
            NamedPipeClientStream pipeStream = new NamedPipeClientStream(".", PipeName, PipeDirection.Out, PipeOptions.Asynchronous);

            // The connect function will indefinitely wait for the pipe to become available
            // If that is not acceptable specify a maximum waiting time (in ms)
            pipeStream.Connect(TimeOut);
            Debug.WriteLine("[Client] Pipe connection established");

            byte[] _buffer = Encoding.UTF8.GetBytes(SendStr);
            pipeStream.BeginWrite(_buffer, 0, _buffer.Length, AsyncSend, pipeStream);
        }
        catch (TimeoutException oEX)
        {
            Debug.WriteLine(oEX.Message);
        }
    }

经过大量的工作,它解决了我的问题几乎完全http://stackoverflow.com/a/3478552/5996253

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM