Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
kenton007
Starting Member
5 Posts |
Posted - 2004-12-23 : 12:09:57
|
I cannot connect to SQL Server on a different machine on the network using ASP.NET. I have tried using both a SqlConnection object directly as well as referencing to a .dll I created (which also used a SqlConnection object) that connects to the DB. Also, my attempt to make a COM+ package failed (and was more work than it was worth).Here is my connection string:integrated security=SSPI;data source=PROD;persist security info=False;initial catalog=DevDBHowever, I can connect using VB.NET in a desktop app using the same connection string without any issues which leads me to think it has something to do with permissions of SQL Server or IIS.Testing the connection from Server Explorer in the VS2003 IDE is successful, in both my VB.NET app and my ASP.NET app.I need some direction on where to begin troubleshooting.SIDENOTE:The same issue occurs with straight ASP and VB 6.0 - VB6 can connect, but ASP can't. For straight ASP we have a COM+ package we can use, so this issue was never investigated before. |
|
DustinMichaels
Constraint Violating Yak Guru
464 Posts |
Posted - 2004-12-23 : 12:19:40
|
You might want to check to see if the system ASPNET user is given rights to access the database. |
 |
|
kenton007
Starting Member
5 Posts |
Posted - 2004-12-23 : 12:54:35
|
The PROD server doesn't have an ASPNET user account, since .NET isn't installed on that machine. My machine has an ASPNET account.Do I create an ASPNET user account on the server then? Or is there something else or another workaround I could use? |
 |
|
DustinMichaels
Constraint Violating Yak Guru
464 Posts |
Posted - 2004-12-23 : 13:03:46
|
I would think that's the problem. Try adding the ASPNET user to the SQL Server machine.I could be wrong but I think its worth a shot. |
 |
|
kenton007
Starting Member
5 Posts |
Posted - 2004-12-23 : 14:47:36
|
Explicitly stating the user id and pwd in the connection string doesn't work either (vs a trusted connection).The PROD server hosts the database, while the WEB server hosts the webpage and IIS 6 (both are Windows 2003).The user id and pwd I provided are part of our network domain (Windows User) and SQL Server Security Logins allows that user, but it uses Windows Authentication. I also created a new Standard login, and it also doesn't work.Any ideas? |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-12-23 : 14:52:42
|
Posting the error would be helpful.Tara |
 |
|
kenton007
Starting Member
5 Posts |
Posted - 2004-12-23 : 15:00:36
|
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.Line 305: Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.ClickLine 306: SqlConnection1.ConnectionString = "user id=xxxxx;pwd=xxxxxx;data source=PROD;persist security info=false;initial catalog=DevDB"Line 307: SqlConnection1.Open()Line 308: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() NETapp.WebForm1.Button2_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\NETapp\WebForm1.aspx.vb:307 System.Web.UI.WebControls.Button.OnClick(EventArgs e) System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) System.Web.UI.Page.ProcessRequestMain() |
 |
|
kenton007
Starting Member
5 Posts |
Posted - 2004-12-23 : 17:19:12
|
I found the answer to my problem in Help:Accessing SQL Server Using a Mapped Windows Domain UserBasically, I had to create a generic Windows Domain account and give it the minimal permissions outlined in the help documentation, and in my Web.config file, I had to map to this account.<identity impersonate="true" userName="MYDOMAIN\mygenericuser" password="thepasswordigavemygenericuser" /> |
 |
|
|
|
|
|
|