文件导入导致我更改我的iis和数据库配置

时间:2015-09-02 18:41:31

标签: asp.net sql-server iis

当我尝试从我的网页导入文件时,我收到某种应用程序池登录错误。因此,我将IIS更改为使用LocalSystem for Identity(但它建议应用程序池标识)。

我改变后发现数据库错误,说NT Authority / System没有权限。因此,我更改了登录安全性并使用dbo权限映射数据库以使其正常工作。

有人能帮助我一些见解吗?该应用程序的其余部分工作正常,没有对IIS和SQL的更改,但就在我执行该文件导入时,它对我咆哮。如何让它以推荐的方式使用应用程序池标识?

其他信息:

Log Name:      Application
Source:        ASP.NET 2.0.50727.0
Date:          9/2/2015 2:10:10 PM
Event ID:      1334
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A

Description:
An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/1/ROOT/eoc7

Process ID: 5636

Exception: System.Data.SqlClient.SqlException

Message: Login failed for user 'IIS APPPOOL\Classic .NET AppPool'.

StackTrace: 
Server stack trace: 
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
   at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
   at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
   at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()

1 个答案:

答案 0 :(得分:0)

使用应用程序池标识运行IIS时从SQL Server获得的错误消息非常准确:"Login failed for user 'IIS APPPOOL\Classic .NET AppPool'"

要在SQL服务器上授予访问权限,您可以使用错误消息(IIS APPPOOL\Classic .NET AppPool)中的名称添加登录名,并将其映射到所需的数据库/为其提供适当的权限。这些应用程序池用户无法在搜索向导中搜索,但可以在“登录名”字段中手动输入:

enter image description here

请注意,您通常会创建一个特定的应用程序池,而不是使用内置的Classic .NET AppPool,这个SO帖子提供了更多信息:Separate application pools for ASP.net applications in IIS