用户IIS APPPOOL \DefaultAppPool登录失败 [英] Login failed for user IIS APPPOOL\DefaultAppPool

查看:133
本文介绍了用户IIS APPPOOL \DefaultAppPool登录失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Web应用程序。突然间我收到错误System.Data.SqlClient.SqlException未被用户代码处理:用户'IIS APPPOOL \DefaultAppPool登录失败。任何人都可以帮忙。

I am working on web application. Suddenly i got the error "System.Data.SqlClient.SqlException was unhandled by user code: Login failed for user 'IIS APPPOOL\DefaultAppPool". Can anybody help.

推荐答案

转到iis - >应用程序池 - >找到应用程序中使用的应用程序池 - >单击它,然后单击动作面板中的高级设置。找到'Identity'属性并将其更改为localsystem。

如果它解决了您的问题,请标记为解决方案。
go to iis -> application pools -> find your application pool used in application -> click it and then click 'Advance Settings' in Actions panel. Find 'Identity' property and change it to localsystem.
Please mark as solution if it solve your problem.


参考以下链接:



http: //www.asp.net/mvc/overview/deployment/visual-studio-web-deployment/deploying-to-iis [ ^ ]



为新数据库创建授权脚本



当应用程序在开发计算机上的IIS中运行时,应用程序使用默认应用程序池的凭据访问数据库。但是,默认情况下,应用程序池标识无权打开数据库。因此,您必须运行脚本才能授予该权限。在本节中,您将创建稍后运行的脚本,以确保应用程序在IIS中运行时可以打开数据库。







运行以下脚本:

With reference to following link:

http://www.asp.net/mvc/overview/deployment/visual-studio-web-deployment/deploying-to-iis[^]

Create a grant script for the new databases

When the application runs in IIS on your development computer, the application accesses the database by using the default application pool's credentials. However, by default, the application pool identity does not have permission to open the databases. So you have to run a script to grant that permission. In this section you create the script that you'll run later to make sure that the application can open the databases when it runs in IIS.



Run the following script:
IF NOT EXISTS (SELECT name FROM sys.server_principals WHERE name = 'IIS APPPOOL\DefaultAppPool')
BEGIN
    CREATE LOGIN [IIS APPPOOL\DefaultAppPool] 
      FROM WINDOWS WITH DEFAULT_DATABASE=[master], 
      DEFAULT_LANGUAGE=[us_english]
END
GO
CREATE USER [WebDatabaseUser] 
  FOR LOGIN [IIS APPPOOL\DefaultAppPool]
GO
EXEC sp_addrolemember 'db_owner', 'WebDatabaseUser'
GO


运行此脚本:



从WINDOWS创建登录[IIS APPPOOL \DefaultAppPool]

GO

--USE表名

GO

创建用户[IIS APPPOOL \DefaultAppPool]登录[IIS APPPOOL \ DefaultAppPool]

GO

EXEC sp_addrolemember'db_datareader','IIS APPPOOL \DefaultAppPool'

GO

EXEC sp_addrolemember'db_datawriter','IIS APPPOOL \DefaultAppPool'
GO
Run This Script :

CREATE LOGIN [IIS APPPOOL\DefaultAppPool] FROM WINDOWS
GO
--USE Table Name
GO
CREATE USER [IIS APPPOOL\DefaultAppPool] FOR LOGIN [IIS APPPOOL\DefaultAppPool]
GO
EXEC sp_addrolemember 'db_datareader', 'IIS APPPOOL\DefaultAppPool'
GO
EXEC sp_addrolemember 'db_datawriter', 'IIS APPPOOL\DefaultAppPool'
GO


这篇关于用户IIS APPPOOL \DefaultAppPool登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆