简体   繁体   English

ASP.NET应用程序池和SQL Server数据连接

[英]Asp.net application pool and sql server data connection

I have an asp.net application that runs on a custom app pool which runs under a service level account. 我有一个在自定义应用程序池上运行的asp.net应用程序,该池在服务级别帐户下运行。 I have anonymous access turned off in web.config. 我在web.config中关闭了匿名访问。 The web server is part of a domain. Web服务器是域的一部分。 The application access a sql server which runs on the same machine. 该应用程序访问在同一台计算机上运行的sql服务器。

Currently, for all users, I impersonate the service level account to access the Database. 当前,对于所有用户,我都模拟了服务级别帐户以访问数据库。 When lots of users are accessing the site, this slows the site down as the lsass process starts using the cpu. 当大量用户访问站点时,这会降低站点速度,因为lsass进程开始使用cpu。

I am not allowed to create a sql server account, I have to work with what I have. 我不允许创建sql服务器帐户,我必须使用已有的东西。 I am also not allowed to add each individual user to the database and give them specific access. 我也不允许将每个用户添加到数据库中并给予他们特定的访问权限。

My question is, how can I set my application and datbase reletionship up such that I dont have to do impersonation of the Service level account and thus avoid CPU thrashing when website usage is high. 我的问题是,我该如何设置我的应用程序和datbase替换,这样我就不必模拟服务级别帐户,从而避免在网站使用率很高时造成CPU崩溃。

You shouldn't have to impersonate the service account. 您不必模拟服务帐户。 The service account is the account that needs access to the database and I suppose it already has. 服务帐户是需要访问数据库的帐户,我想它已经拥有了。 Have you already tried running your application without impersonating the service account when you access the database? 您是否已经尝试在访问数据库时不假冒服务帐户的情况下运行应用程序? This should work. 这应该工作。

To perform a simple test, check the identity returned by WindowsIdentity.GetCurrent() (inside Page_Load for example). 要执行简单的测试,请检查WindowsIdentity.GetCurrent()返回的身份(例如,在Page_Load内部)。 This should return the application pool identity and this is the identity that will be used to access the database. 这应该返回应用程序池标识,这是将用于访问数据库的标识。

Of course, this only works if you do not have client impersonation configured in your Web.config file. 当然,这仅在Web.config文件中未配置客户端模拟的情况下才有效。 But since this is not a general practice except for some corner cases I suppose you don't use this. 但是由于这不是通用的做法,除了一些特殊情况,我想您不要使用它。 Client impersonation is not necessary for determining who the current user is, you should only use it when you want to access third-party systems (databases, fileshares, queues, ...) using the identity of the currently logged-on user (which is not a very scalable approach). 客户端模拟对于确定当前用户不是必需的,仅当您要使用当前登录用户的身份(第三方,数据库,文件共享,队列等)访问第三方系统时,才应使用客户端模拟。不是一种可扩展性很高的方法)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM