[英]WCF ConcurrencyMode.Multiple
I dont know how to check if im right or wrong so your help will be great. 我不知道如何检查即时消息是对还是错,因此您的帮助会很大。
A. From my understanding, IsOneWay=true = the client doesnt want to wait for the method to end. 答:据我了解,IsOneWay = true =客户端不希望等待方法结束。 so the service will execute this method when he want.
因此服务会在需要时执行此方法。 But, in some cases, does the service will use multi-threading to execute the method?
但是,在某些情况下,服务是否将使用多线程执行该方法?
B. when I use ConcurrencyMode.Multiple, what is the diffrence between using IsOneWay=true & IsOneWay=false. B.当我使用ConcurrencyMode.Multiple时,使用IsOneWay = true和IsOneWay = false之间有什么区别。
ConcurrencyMode and Messaging Pattern are not so directly related. ConcurrencyMode和Messaging Pattern不是那么直接相关。
IsOneWay affects how Client and Server interact. IsOneWay影响客户端和服务器的交互方式。
The ConcurrencyMode is a server-side issue, the Client is not aware of this setting. ConcurrencyMode是服务器端问题,客户端不知道此设置。
From: http://msdn.microsoft.com/en-us/library/ms751496.aspx 来自: http : //msdn.microsoft.com/zh-cn/library/ms751496.aspx
HTTP is, by definition, a request/response protocol;
根据定义,HTTP是请求/响应协议; when a request is made, a response is returned.
发出请求时,将返回响应。 This is true even for a one-way service operation that is exposed over HTTP.
即使对于通过HTTP公开的单向服务操作,也是如此。 When the operation is called, the service returns an HTTP status code of 202 before the service operation has executed.
调用操作时,服务将在执行服务操作之前返回HTTP状态代码202。 This status code means that the request has been accepted for processing, but the processing has not yet been completed.
此状态码表示该请求已被接受以进行处理,但处理尚未完成。 The client that called the operation blocks until it receives the 202 response from the service.
调用操作的客户端将阻塞,直到它接收到来自服务的202响应为止。 This can cause some unexpected behavior when multiple one-way messages are sent using a binding that is configured to use sessions.
当使用配置为使用会话的绑定发送多个单向消息时,这可能会导致某些意外行为。 The wsHttpBinding binding used in this sample is configured to use sessions by default to establish a security context.
默认情况下,此示例中使用的wsHttpBinding绑定配置为使用会话来建立安全上下文。 By default, messages in a session are guaranteed to arrive in the order in which they are sent.
默认情况下,保证会话中的消息按发送的顺序到达。 Because of this, when the second message in a session is sent, it is not processed until the first message has been processed.
因此,发送会话中的第二条消息时,直到处理完第一条消息后,才会对其进行处理。 The result of this is that the client does not receive the 202 response for a message until the processing of the previous message has been completed.
这样的结果是,直到前一个消息的处理完成,客户端才收到消息的202响应。 The client therefore appears to block on each subsequent operation call.
因此,客户端似乎阻止了每个后续的操作调用。 To avoid this behavior, this sample configures the runtime to dispatch messages concurrently to distinct instances for processing.
为了避免这种行为,此示例将运行时配置为同时将消息调度到不同的实例进行处理。 The sample sets InstanceContextMode to PerCall so that each message can be processed by a different instance.
该示例将InstanceContextMode设置为PerCall,以便可以由不同的实例处理每条消息。 ConcurrencyMode is set to Multiple to allow more than one thread to dispatch messages at a time.
ConcurrencyMode设置为Multiple,以允许多个线程一次调度消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.