'Access denied' when accessing remote SQL Server

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top