SQL Server does not exist or access denied.

B

Bob

Having trouble getting started.

I created an instance of MSDE called VSDOTNET on a computer with the
name of sysdev.

Using MS SQL Web Adminstrator I created a database called temp with a
table called customer.

In Visual Studio .NET I can see and access the data in the table. The
dataconnection is called sysdev\vsdotnet\temp.dbo

The connection string in the properties window is:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=temp;Data Source=sysdev\vsdotnet;Use
Procedure for Prepare=1;Auto Translate=True;Packet
Size=4096;Workstation ID=SYSDEV;Use Encryption for Data=False;Tag with
column collation when possible=False

However with an application (this case a webform, .aspx) I can not
access the data. I keep getting the error message below.

Any help with why this doesn't work?


Server Error in '/' Application.
--------------------------------------------------------------------------------

SQL Server does not exist or access denied.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: SQL Server does
not exist or access denied.

Source Error:


Line 10:
Line 11: conPubs = new SqlConnection(
"Server=sysdev\vsdotnet;uid=bob;pwd=isgood;database=temp" );
Line 12: conPubs.Open();
Line 13: cmdSelectAuthors = new SqlCommand( "Select fn From
customer", conPubs );
Line 14: dtrAuthors = cmdSelectAuthors.ExecuteReader();


Source File: c:\inetpub\wwwroot\sqldatareader.aspx Line: 12

Stack Trace:


[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString
options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
ASP.SqlDataReader_aspx.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\sqldatareader.aspx:12
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
 
W

William Ryan eMVP

you're using SSPI so you need to use the asp_net account and make sure it
has permissions. Otherwise, change the context and pass in a valid username
and password for the db. Verify the asp account has the permissions granted
too.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com
 
A

Andy Gaskell

If you look at the exception text he's not using SSPI, correct?

"conPubs = new
SqlConnection("Server=sysdev\vsdotnet;uid=bob;pwd=isgood;database=temp" );"


William Ryan eMVP said:
you're using SSPI so you need to use the asp_net account and make sure it
has permissions. Otherwise, change the context and pass in a valid username
and password for the db. Verify the asp account has the permissions granted
too.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com

Bob said:
Having trouble getting started.

I created an instance of MSDE called VSDOTNET on a computer with the
name of sysdev.

Using MS SQL Web Adminstrator I created a database called temp with a
table called customer.

In Visual Studio .NET I can see and access the data in the table. The
dataconnection is called sysdev\vsdotnet\temp.dbo

The connection string in the properties window is:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=temp;Data Source=sysdev\vsdotnet;Use
Procedure for Prepare=1;Auto Translate=True;Packet
Size=4096;Workstation ID=SYSDEV;Use Encryption for Data=False;Tag with
column collation when possible=False

However with an application (this case a webform, .aspx) I can not
access the data. I keep getting the error message below.

Any help with why this doesn't work?


Server Error in '/' Application.
--------------------------------------------------------------------------
------

SQL Server does not exist or access denied.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: SQL Server does
not exist or access denied.

Source Error:


Line 10:
Line 11: conPubs = new SqlConnection(
"Server=sysdev\vsdotnet;uid=bob;pwd=isgood;database=temp" );
Line 12: conPubs.Open();
Line 13: cmdSelectAuthors = new SqlCommand( "Select fn From
customer", conPubs );
Line 14: dtrAuthors = cmdSelectAuthors.ExecuteReader();


Source File: c:\inetpub\wwwroot\sqldatareader.aspx Line: 12

Stack Trace:


[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString
options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
ASP.SqlDataReader_aspx.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\sqldatareader.aspx:12
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
 
N

Nicholas Paldino [.NET/C# MVP]

William, Andy, and Bob,

William touched on it partially. It's not a matter of having the
ASP.NET account have permissions being able to access the database (since
the credentials are in the connection string). By default, ASP.NET doesn't
have network permissions, and it looks that the machine the SQL server
machine is a different machine than the machine hosting ASP.NET.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

William Ryan eMVP said:
you're using SSPI so you need to use the asp_net account and make sure it
has permissions. Otherwise, change the context and pass in a valid username
and password for the db. Verify the asp account has the permissions granted
too.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com

Bob said:
Having trouble getting started.

I created an instance of MSDE called VSDOTNET on a computer with the
name of sysdev.

Using MS SQL Web Adminstrator I created a database called temp with a
table called customer.

In Visual Studio .NET I can see and access the data in the table. The
dataconnection is called sysdev\vsdotnet\temp.dbo

The connection string in the properties window is:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=temp;Data Source=sysdev\vsdotnet;Use
Procedure for Prepare=1;Auto Translate=True;Packet
Size=4096;Workstation ID=SYSDEV;Use Encryption for Data=False;Tag with
column collation when possible=False

However with an application (this case a webform, .aspx) I can not
access the data. I keep getting the error message below.

Any help with why this doesn't work?


Server Error in '/' Application.
--------------------------------------------------------------------------
------

SQL Server does not exist or access denied.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: SQL Server does
not exist or access denied.

Source Error:


Line 10:
Line 11: conPubs = new SqlConnection(
"Server=sysdev\vsdotnet;uid=bob;pwd=isgood;database=temp" );
Line 12: conPubs.Open();
Line 13: cmdSelectAuthors = new SqlCommand( "Select fn From
customer", conPubs );
Line 14: dtrAuthors = cmdSelectAuthors.ExecuteReader();


Source File: c:\inetpub\wwwroot\sqldatareader.aspx Line: 12

Stack Trace:


[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString
options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
ASP.SqlDataReader_aspx.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\sqldatareader.aspx:12
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
 
W

William Ryan eMVP

This is the code from the properties window that he posted:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=temp;Data Source=sysdev\vsdotnet;Use
Procedure for Prepare=1;Auto Translate=True;Packet
Size=4096;Workstation ID=SYSDEV;Use Encryption for Data=False;Tag with
column collation when possible=False


He may be using another one but I can't tell that for sure. If he was using
SSPI, that would explain why the username is seen in the exception but not
he connection string.

HTH,

Bill
www.devbuzz.com
www.knowdotnet.com

Andy Gaskell said:
If you look at the exception text he's not using SSPI, correct?

"conPubs = new
SqlConnection("Server=sysdev\vsdotnet;uid=bob;pwd=isgood;database=temp" );"
William Ryan eMVP said:
you're using SSPI so you need to use the asp_net account and make sure it
has permissions. Otherwise, change the context and pass in a valid username
and password for the db. Verify the asp account has the permissions granted
too.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com

Bob said:
Having trouble getting started.

I created an instance of MSDE called VSDOTNET on a computer with the
name of sysdev.

Using MS SQL Web Adminstrator I created a database called temp with a
table called customer.

In Visual Studio .NET I can see and access the data in the table. The
dataconnection is called sysdev\vsdotnet\temp.dbo

The connection string in the properties window is:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=temp;Data Source=sysdev\vsdotnet;Use
Procedure for Prepare=1;Auto Translate=True;Packet
Size=4096;Workstation ID=SYSDEV;Use Encryption for Data=False;Tag with
column collation when possible=False

However with an application (this case a webform, .aspx) I can not
access the data. I keep getting the error message below.

Any help with why this doesn't work?


Server Error in '/' Application.

--------------------------------------------------------------------------
------

SQL Server does not exist or access denied.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: SQL Server does
not exist or access denied.

Source Error:


Line 10:
Line 11: conPubs = new SqlConnection(
"Server=sysdev\vsdotnet;uid=bob;pwd=isgood;database=temp" );
Line 12: conPubs.Open();
Line 13: cmdSelectAuthors = new SqlCommand( "Select fn From
customer", conPubs );
Line 14: dtrAuthors = cmdSelectAuthors.ExecuteReader();


Source File: c:\inetpub\wwwroot\sqldatareader.aspx Line: 12

Stack Trace:


[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
 
A

Andy Gaskell

That's strange - I haven't modified my ASPNET account at all and my
machine.config is set so that I run under the ASPNET account. I created a
new web application and configured a connection to our development SQL
Server and it worked just fine.

Nicholas Paldino said:
William, Andy, and Bob,

William touched on it partially. It's not a matter of having the
ASP.NET account have permissions being able to access the database (since
the credentials are in the connection string). By default, ASP.NET doesn't
have network permissions, and it looks that the machine the SQL server
machine is a different machine than the machine hosting ASP.NET.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

William Ryan eMVP said:
you're using SSPI so you need to use the asp_net account and make sure it
has permissions. Otherwise, change the context and pass in a valid username
and password for the db. Verify the asp account has the permissions granted
too.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com

Bob said:
Having trouble getting started.

I created an instance of MSDE called VSDOTNET on a computer with the
name of sysdev.

Using MS SQL Web Adminstrator I created a database called temp with a
table called customer.

In Visual Studio .NET I can see and access the data in the table. The
dataconnection is called sysdev\vsdotnet\temp.dbo

The connection string in the properties window is:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False;Initial Catalog=temp;Data Source=sysdev\vsdotnet;Use
Procedure for Prepare=1;Auto Translate=True;Packet
Size=4096;Workstation ID=SYSDEV;Use Encryption for Data=False;Tag with
column collation when possible=False

However with an application (this case a webform, .aspx) I can not
access the data. I keep getting the error message below.

Any help with why this doesn't work?


Server Error in '/' Application.

--------------------------------------------------------------------------
------

SQL Server does not exist or access denied.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: SQL Server does
not exist or access denied.

Source Error:


Line 10:
Line 11: conPubs = new SqlConnection(
"Server=sysdev\vsdotnet;uid=bob;pwd=isgood;database=temp" );
Line 12: conPubs.Open();
Line 13: cmdSelectAuthors = new SqlCommand( "Select fn From
customer", conPubs );
Line 14: dtrAuthors = cmdSelectAuthors.ExecuteReader();


Source File: c:\inetpub\wwwroot\sqldatareader.aspx Line: 12

Stack Trace:


[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
 

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

Top