A
Anton Sokolovsky
Hello All,
Please help. I am completely stuck. Any suggestions are very welcomed.
I have ASP.NET application that impersonates certain user
<impersonate="true" userName="registry:..." password="registry:..."/>
Everythins runs ok on many systems except one: when connecting to database
(either SQL Authentication or Trused - doesn't matter) the applications
keeps getting exception :
Error:
System.Web.HttpUnhandledException: Exception of type
System.Web.HttpUnhandledException was thrown. --->
System.UnauthorizedAccessException: Access is denied.
at System.EnterpriseServices.Platform.Initialize()
at System.EnterpriseServices.ResourcePool..ctor(TransactionEndDelegate
cb)
at System.Data.SqlClient.ConnectionPool..ctor(DefaultPoolControl ctrl)
at
System.Data.SqlClient.PoolManager.FindOrCreatePool(DefaultPoolControlctrl,
IntPtr SID)
at
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
Looks like an exception in Resource Pool constructor. What is
Platform.Initialize() ?
Code where it fails is rather simple:
using (SqlConnection sqlConnection = new
SqlConnection(ConnectionString))
{
sqlConnection.Open();
SqlCommand command = sqlConnection.CreateCommand();
command.CommandTimeout = defaultFetchTimeout;
command.CommandText = query;
command.Transaction =
sqlConnection.BeginTransaction(IsolationLevel.ReadUncommitted);
using (SqlDataReader dataReader = command.ExecuteReader())
{
while (dataReader.Read())
{
//...
}
}
command.Transaction.Commit();
sqlConnection.Close();
}
System is Windows 2000.
Impersonated user has all rights for registry, it has all rights for my web
application's folder and for temporary ASP.NET files too. So it is not
registry or filesystems access problem.
Changing the solution not to impersonate given user is not an option. SQL
Server and ASP.NET applications are on different systems.
I tried reproducing this exception on other systems but without success:
1. tried stopping MDTC on web server - no success
2. tried stopping MDTC on sql server system - no success
Solutions that I found in Internet:
1. tried using IP adress instead of hostname in connection string - no
success
2. tried granting full registry access to the user being impersonated - no
success
Thanks in advance,
Anton.
Please help. I am completely stuck. Any suggestions are very welcomed.
I have ASP.NET application that impersonates certain user
<impersonate="true" userName="registry:..." password="registry:..."/>
Everythins runs ok on many systems except one: when connecting to database
(either SQL Authentication or Trused - doesn't matter) the applications
keeps getting exception :
Error:
System.Web.HttpUnhandledException: Exception of type
System.Web.HttpUnhandledException was thrown. --->
System.UnauthorizedAccessException: Access is denied.
at System.EnterpriseServices.Platform.Initialize()
at System.EnterpriseServices.ResourcePool..ctor(TransactionEndDelegate
cb)
at System.Data.SqlClient.ConnectionPool..ctor(DefaultPoolControl ctrl)
at
System.Data.SqlClient.PoolManager.FindOrCreatePool(DefaultPoolControlctrl,
IntPtr SID)
at
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
Looks like an exception in Resource Pool constructor. What is
Platform.Initialize() ?
Code where it fails is rather simple:
using (SqlConnection sqlConnection = new
SqlConnection(ConnectionString))
{
sqlConnection.Open();
SqlCommand command = sqlConnection.CreateCommand();
command.CommandTimeout = defaultFetchTimeout;
command.CommandText = query;
command.Transaction =
sqlConnection.BeginTransaction(IsolationLevel.ReadUncommitted);
using (SqlDataReader dataReader = command.ExecuteReader())
{
while (dataReader.Read())
{
//...
}
}
command.Transaction.Commit();
sqlConnection.Close();
}
System is Windows 2000.
Impersonated user has all rights for registry, it has all rights for my web
application's folder and for temporary ASP.NET files too. So it is not
registry or filesystems access problem.
Changing the solution not to impersonate given user is not an option. SQL
Server and ASP.NET applications are on different systems.
I tried reproducing this exception on other systems but without success:
1. tried stopping MDTC on web server - no success
2. tried stopping MDTC on sql server system - no success
Solutions that I found in Internet:
1. tried using IP adress instead of hostname in connection string - no
success
2. tried granting full registry access to the user being impersonated - no
success
Thanks in advance,
Anton.