0

All of a sudden, when I try to log in to my VB.NET Web Forms app, I get this error:

System.Threading.SemaphoreFullException: Adding the specified count to the semaphore would cause it to exceed its maximum count.

The line of code that threw this exception is:

myTemp2Reader.Close()

Why would closing a DataReader throw this exception, and how can I stop it from doing so?

This started a little while ago when I noticed that after making some changes to the code, I could no longer hit breakpoints when debugging. I undid the changes, but that didn't help. So I reset IIS and I think that's when the semaphore thing started...

ekolis
  • 6,270
  • 12
  • 50
  • 101

1 Answers1

0

Try to add “Pooling=False” condition to connection string then it will disable the connection pool and run the application without any problem.

<connectionStrings>
<add name="dbconnection" connectionString="Data Source=SureshDasari; Initial Catalog=TestDatabase; Persist Security Info=True;User ID=test;Password=test; Pooling=False;" />
</connectionStrings>

refer this link1 and link2 for more detail.

Jalpa Panchal
  • 8,251
  • 1
  • 11
  • 26