加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

当通过ASP.NET成员资格检查用户角色时,SemaphoreFullException

发布时间:2020-12-15 19:14:26 所属栏目:asp.Net 来源:网络整理
导读:我有一个页面,在执行一些任务之前检查用户是否处于特定的角色,并且对功能没有问题,并且没有对相关代码进行明显的相关更改。该站点在我的开发计算机(Windows Vista)上运行IIS 7.0,数据库是MS SQL 2005在单独的服务器上。突然,对User.IsInRole的所有调用
我有一个页面,在执行一些任务之前检查用户是否处于特定的角色,并且对功能没有问题,并且没有对相关代码进行明显的相关更改。该站点在我的开发计算机(Windows Vista)上运行IIS 7.0,数据库是MS SQL 2005在单独的服务器上。突然,对User.IsInRole的所有调用都会导致

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

我确定重新启动IIS将“解决”的问题,但我想了解是什么原因,所以我可以确保它不会发生在我的生产网站。

堆栈跟踪的顶部是:

[SemaphoreFullException: Adding the specified count to the semaphore would cause it to exceed its maximum count.]
System.Threading.Semaphore.Release(Int32 releaseCount) +6065293
System.Data.ProviderBase.DbConnectionPool.PutNewObject(DbConnectionInternal obj) +57
System.Data.ProviderBase.DbConnectionPool.DeactivateObject(DbConnectionInternal obj) +338
System.Data.ProviderBase.DbConnectionPool.PutObject(DbConnectionInternal obj,Object owningObject) +163
System.Data.ProviderBase.DbConnectionInternal.CloseConnection(DbConnection owningObject,DbConnectionFactory connectionFactory) +117
System.Data.SqlClient.SqlInternalConnection.CloseConnection(DbConnection owningObject,DbConnectionFactory connectionFactory) +37
System.Data.SqlClient.SqlConnection.Close() +158
System.Web.DataAccess.SqlConnectionHolder.Close() +25
System.Web.Security.SqlRoleProvider.GetRolesForUser(String username) +847
System.Web.Security.RolePrincipal.IsInRole(String role) +182

解决方法

此问题已通过在Windows任务栏上重新启动ASP.NET开发服务器修复。

或永久添加“Pooling = False;”到连接字符串应该解决问题。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读