473,509 Members | 2,863 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Db Connection Failure

GD

I've downloaded the ASP.Net Commerce Starter kit (Sample ASP .Net
application) from the Microsoft website and have set it up to run using a
SQL Server on a remote machine.

My problem is that the app can't find the database. Using debug mode I've
checked that the correct connection string is being applied and I've written
a quickie VB .Net app to check that the connection string/Logon details are
valid. In the VB app the DB connects without any problem.

I suspect the problem has something to do with the fact that the Db access
is being attempted from a DLL (ASPNETCommerce.dll) within the IIS app. To
this end I've disabled the firewall on both machines...but still nothing.
Using SQLProfiler I can see that no connection attempt is ever made to the
Db.

Is there a setting in IIS that I've overlooked ?

The error reported is - System.Data.SqlClient.SqlException: SQL Server does
not exist or access denied.

Both machines are Windows 2000, SP 4. I am using .Net framework 1.1

Thanks

Gary

Nov 18 '05 #1
4 1241
There is a way to check the connection to the database.

1. Create a text file on your desktop and rename it as Test.udl
2. Double click on the file.
3. Click on the Provider tab and choose Microsoft OLE DB Provider for SQL
Server.
4. Enter the SQL Server name, User name, and Password.
5. Choose the target database
6. Finally, click on Test Connection.
"GD" <No*****************************@eircom.net.NoSpam > wrote in message
news:#2**************@tk2msftngp13.phx.gbl...

I've downloaded the ASP.Net Commerce Starter kit (Sample ASP .Net
application) from the Microsoft website and have set it up to run using a
SQL Server on a remote machine.

My problem is that the app can't find the database. Using debug mode I've
checked that the correct connection string is being applied and I've written a quickie VB .Net app to check that the connection string/Logon details are valid. In the VB app the DB connects without any problem.

I suspect the problem has something to do with the fact that the Db access
is being attempted from a DLL (ASPNETCommerce.dll) within the IIS app. To
this end I've disabled the firewall on both machines...but still nothing.
Using SQLProfiler I can see that no connection attempt is ever made to the
Db.

Is there a setting in IIS that I've overlooked ?

The error reported is - System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.

Both machines are Windows 2000, SP 4. I am using .Net framework 1.1

Thanks

Gary

Nov 18 '05 #2
GD

Thanks - I've done that ... and as I suspected, the connection succeeded. I
think there is a security/rights issue around the DLL thats attempting the
connection from IIS.

Gary

"Hayato Iriumi" <hi*****@hotmail.com> wrote in message
news:uo**************@TK2MSFTNGP11.phx.gbl...
There is a way to check the connection to the database.

1. Create a text file on your desktop and rename it as Test.udl
2. Double click on the file.
3. Click on the Provider tab and choose Microsoft OLE DB Provider for SQL
Server.
4. Enter the SQL Server name, User name, and Password.
5. Choose the target database
6. Finally, click on Test Connection.

Nov 18 '05 #3
Wait a minute, if the DLL uses the same connection information to
connect to the database, it should work. If the test works, and the DLL
is using the same exact connection information, there should be no
different. Now, are you using Windows Integrated security to conenct to
the database? If so, then you should really look into who you are
running the DLL as. From what I read, you use the DLL from your web app,
so it's probably running as aspnet account.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4
GD
After a bit of searching around in MSDN I found the solution.

The problem stems from the fact that Aspnet_wp.exe runs under the default
ASPNET account on the local machine and does not have access to the remote
machine that is hosting SQL Server.

The solution was to enable "Impersonation" in the Web.Config file and
supplying a valid username and password for the remote machine.

e.g.
Add the line
<identity impersonate="true" userName="RemoteMachineName\UserName"
password="myPass"/>

From a security point of view this could be seen as a bit lacklustre so you
could also enter the username and pwd into the registry ( full details are
in the .Net help files )

Anyone interested should take a look at Kb article 315159 (
http://support.microsoft.com/default...b;en-us;315159 ) and then
look up "ASP Impersonation" in the .Net help file.

Gary

Thanks - I've done that ... and as I suspected, the connection succeeded. I think there is a security/rights issue around the DLL thats attempting the
connection from IIS.

Gary

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
3218
by: AMC | last post by:
Hi, I'm using an include file to store the connection string to a database. Whenever I try to reference that string to open a connection in the page that includes the file I get the error 'empy...
2
6793
by: Pandis Ippokratis | last post by:
Hi, I have the following problem: I am implementing a server in Java and I use jdbc to connect to an Oracle 9.0.2 db. All seem to work fine, but when I intensionally cause a network failure...
1
2306
by: lauren quantrell | last post by:
Admitedly a very open-ended question but here goes ... Why so may "Connection failure" error messages when my Access 2K users are executing stored procedures that contain UPDATE or INSERT...
2
1484
by: Diffident | last post by:
Hello All, I am trying to redirect users to a standby webpage in case our application is down due to database server failure. To facilitate this I am opening a test connection within a try/catch...
1
3010
by: Jac | last post by:
Hey, How can I test if there is an connection-exception when using database application block from the enterprise service? I stopped the sqlserver. I do now the following : Database db =...
3
3545
by: pvrsatya | last post by:
hi all i am using TCP/Ip i am running server application in one PC client application in other PC i am connecting these thro PC's in LAN If i remove the LAN cable
3
5479
by: tulika dutta | last post by:
after 8 hrs my MySQL connection with JDBC gets time out. It gives the error java.sql.SQLException: No operations allowed after connection closed.Connection was implicitly closed due to underlying...
6
8139
Cintury
by: Cintury | last post by:
Hi all, I've developed a mobile application for windows mobile 5.0 that has been in use for a while (1 year and a couple of months). It was developed in visual studios 2005 with a back-end sql...
2
4943
by: samadams_2006 | last post by:
Hello, I have a problem that I'm hoping someone will be able to help me resolve. 1) I have a C# Web Site in which I connect to the database: "Install Microsoft SQL Server 2005 Express...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7137
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7347
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7416
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5656
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5062
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3207
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
443
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.