Adding the specified count to the semaphore would cause it to exceed its maximum count. c#


Adding the specified count to the semaphore would cause it to exceed its maximum count. C# An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. This exception is cuased when the max no of connection pool is reached.

Semphore adding overview


Adding the given count to the semaphore would cause it to exceed its maximum count.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

For this error to occur there are two reasons

1. you might have public the solution by keeping the debug points in the .cs/.vb pages,

solutions: a.publish removing the debug points
b. in web.config file




< configuration >
< system.web>
< compilation debug="true"/>
</ system.web>
< /configuration>




2. Too much pooling will cause the semaphore overflooded.
in web.config connection string just specidy the pooling='false'



<add key="ConnectionString" value="Data Source=abc;user id=sa;password=pwd;database=dbname;pooling='false';" />




Description


A Connection Pool is maintained internally by the Connection Pool Manager. When a request for a subsequent connection comes in, the Connection Pool Manager searches the pool for the availability of a free connection and returns it to the application if one is available.

1.If any unused connection is available, it returns one. 2.If all connections are used up, a new connection is created and added to the pool. 3.If the number of connections reaches the maximum number of connections in the pool.
Connection pooling is enabled by default.

Data Source=TestServer;Initial Catalog=Northwind; User ID=Chester;Password=Tester;Pooling=False;


Comments

No responses found. Be the first to comment...