[英]What does "The maximum number of server instances has been exceeded" mean?
System.IO.Pipes.NamedPipeServerStream class throws IOException and the documentation says The maximum number of server instances has been exceeded. System.IO.Pipes.NamedPipeServerStream 类抛出 IOException 并且文档说已超过最大服务器实例数。 This message is not very clear to me.
这个消息对我来说不是很清楚。 Can someone explain it in terms of I can understand?
有人可以用我能理解的方式解释它吗? Does it mean that the same code is being executed by two different processes or something like that?
这是否意味着两个不同的进程或类似的东西正在执行相同的代码? How can I avoid it if it happens rarely?
如果很少发生,我该如何避免?
I am using the following constructor:我正在使用以下构造函数:
int maxNumberServerInstance = 1;
new NamedPipeServerStream(name, PipeDirection.InOut, maxNumberServerInstance , PipeTransmissionMode.Message, PipeOptions.None, bufferSize, bufferSize, pipeSecurity);
I get IOException.我得到 IOException。
Let's visit the documentation.让我们访问文档。
NamedPipeServerStream Class NamedPipeServerStream 类
Exceptions
例外
IOException
The maximum number of server instances has been exceeded.IOException
已超出服务器实例的最大数量。
NamedPipeServerStream.MaxAllowedServerInstances Field NamedPipeServerStream.MaxAllowedServerInstances 字段
Represents the maximum number of server instances that the system resources allow.
表示系统资源允许的最大服务器实例数。
Remarks
评论
Use the MaxAllowedServerInstances when creating a NamedPipeServerStream object to set the maximum number of server instances that the system resources allow.
在创建 NamedPipeServerStream 对象时使用 MaxAllowedServerInstances 来设置系统资源允许的最大服务器实例数。
In short the error is telling you that the maximum amount of instances has been created.简而言之,错误告诉您已经创建了最大数量的实例。
You will get this if you have used the default constructor with just the name, additionally you will get a pipe with the following characteristics:如果您仅使用带有名称的默认构造函数,您将获得此信息,此外,您还将获得一个具有以下特征的管道:
A default pipe direction of InOut.
InOut 的默认管道方向。
The maximum number of server instances that share the same name set to 1.
共享相同名称的最大服务器实例数设置为 1。
A PipeTransmissionMode value of Byte.
Byte 的 PipeTransmissionMode 值。
A PipeOptions value of None.
无的 PipeOptions 值。
Default input and output buffer sizes.
默认输入和输出缓冲区大小。
No pipe security.
没有管道安全。
A HandleInheritability value of None.
None 的 HandleInheritability 值。
No specified additional PipeAccessRights.
没有指定额外的 PipeAccessRights。
At minimum you would want to use the following constructor if you need more than one instance:如果需要多个实例,至少需要使用以下构造函数:
NamedPipeServerStream(String, PipeDirection, Int32) NamedPipeServerStream(String, PipeDirection, Int32)
Parameters
参数
pipeName
String
管道名称
String
- The name of the pipe.
管道的名称。
direction
PipeDirection
方向
PipeDirection
- One of the enumeration values that determines the direction of the pipe.
确定管道方向的枚举值之一。
maxNumberOfServerInstances
Int32
maxNumberOfServerInstances
Int32
- The maximum number of server instances that share the same name.
共享相同名称的服务器实例的最大数量。 You can pass MaxAllowedServerInstances for this value.
您可以为此值传递 MaxAllowedServerInstances。
Lastly, if you are getting this error and you have only one instance, you probably have a subtle problem with how you are creating them.最后,如果您收到此错误并且您只有一个实例,则您的创建方式可能存在微妙的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.