I recently encountered a problem that is confusing WCF . In RC1 Suddenly, applications with excellent operation began to be intermittently unavailable for building in the release. . Net 3.0 . The most complicated issue is that the error is not returned and debugging information is not provided. The customer did not return the call to the server, but hung down, and the server did not provide fault information. It seems that the message enters the dead zone , .
In WCF After some consultation, the team is determined to change to the default Servicethrottling Actions are at the root of building. The default value is 16 maxconcurrentcils And 10 maxconcurrentsessions, So, The customer actually enters the dead zone during the call, and the server cannot provide any information because it cannot even process them. In this case, the customer generates multiple threads (~ 10 Agents ) And multiple asynchronous requests are published. (~ 15) From each agent. You make this estimation, and you can see what is happening.
two tasks are required. first, Update app. config the file section is as follows:
<Behaviors>
<Servicebehaviors>
<Behavior name = "newbehavior">
<Servicethrottling maxconcurrentcils = "50" maxconcurrentsessions = "50"/>
</Behavior>
</Servicebehaviors>
</Behaviors>
The above is translated from an English blog. because I am not an English major, it may be a bit difficult to translate or wrong. Please refer to the original article.
Http://blogs.msdn.com/karstenj/archive/2006/11/15/wcf-calls-hanging-without-any-debug-or-fault-information.aspx
Solution 2
Recently, we found that the reason for exceeding the default session value is:
Wcfvdselect. vdclsserviceclient myservice = new vditemselect. wcfvdselect. vdclsserviceclient ();
Here, wcfvdselect is the name when you add a service reference on the client, and vdclsserviceclien is the service class .. getstring is the method in the class ..
Multiple call errorsProgram:
Private void btnok_click (Object sender, eventargs E)
{
Wcfvdselect. vdclsserviceclient myservice = new vditemselect. wcfvdselect. vdclsserviceclient ();
Myservice. getstring ("AAA ");
}
Every time we call the WCF Service, we create an instance. In this case, the WCF does not create a session .. when you click the button ten times, an error occurs .. the reason exceeds the default value of the session ....
In fact, we can use a static variable to put it in the memory without releasing it, as shown in
Private staticwcfvdselect. vdclsserviceclient myservice = new vditemselect. wcfvdselect. vdclsserviceclient ();
Private void btnok_click (Object sender, eventargs E)
{
Myservice. getstring ("AAA ");
}
No matter how many times you click it, there will be no errors. In this way, WCF may think it is a session ....
The first solution and the second solution can solve the problem. However, the first solution does not know how many sessions to set. The second solution is better to reduce the number of sessions.