In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what is the way of WCF conversation service". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
WCF session Service (Sessionful Service): one service instance is assigned to each client connection. Client activation mode similar to Net Remoting. Create a dedicated service instance for each client. As long as the session does not end, the instance will not be destroyed. For a session service, a client agent corresponds to a service instance. That is, the service in the session service corresponds to the agent, not to a client.
Configuration development:
The default activation mode for service instances is session service mode. We can also show how to configure the session service, using [ServiceBehavior (InstanceContextMode = InstanceContextMode.PerSession)]. The specific code is as follows:
Service class. WCF session service
[ServiceBehavior (InstanceContextModeInstanceContextMode = InstanceContextMode.PerSession)] public class WCFServicePerSession: IWCFService {}
After the service configuration [ServiceBehavior (InstanceContextMode = InstanceContextMode.PerSession)], you need to configure [ServiceContract (SessionMode=SessionMode.Allowed)] at the service contract level, and the service metadata will contain the SessionMode value. This information is included when the client's WCF is deserialized to determine whether the service uses session mode, where SessionMode is an enumerated type:
Public enum SessionMode {Allowed, Required, NotAllowed}
Not all binding protocols support session transfer mode. TCP is a transmission control protocol that maintains a connection with the client. While HTTP is connectionless, we cannot guarantee its session connection with the client.
Note:
(1) there is a scalability problem in WCF session service. Because each client needs to maintain a session, it takes up more resources to save the service session state. If there are multiple independent clients, it is too expensive to create a dedicated service instance.
(2) the relationship between WCF service binding protocols and session characteristics is shown in the following table.
(3) the mixed definition of monotone service and session contract in the same session service type should be avoided, and the session should be guaranteed to be reliable, a service that implements the session contract. All contracts exposed by endpoints it contains should use bindings that support reliable transport sessions.
(4) InactivityTimeout can configure a new idle timeout value, and the session will be terminated when the idle time of the service instance exceeds this range. The default value of the InactivityTimeout property is 10 minutes. This value cannot be set to a value less than or equal to 0, or an ArgumentOutOfRangeException exception will be thrown.
This is the end of the content of "what is the way of WCF session service". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.