Tuesday, February 14, 2012

Cant connect to remote SQL Server from my ASP.NET 2.0

I’m going nuts and need some help with my ASP.NET 2.0 application which has trouble talking to a remote SQL Server 2000. First, before I describe my problem let me say that everything works perfectly on my XP development workstation when I point to the local SQL Server database. Screens load fine, saves and edits all work perfectly.

Problem is when I connecting to SQL Server on a remote windows 2003 server I get

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

Now, I’ve researched this error and have successfully made the following changes to the remote windows 2003 server where the database resides:

1) Added logins for “ASPNET”, “NT AUTHORITY\NETWORK SERVICE”, and “IIS_WPG”. The reason I added NT AUTHORITY is because we plan on deploying this web site to the same windows 2003 server and I understand that IIS6 (on this server) has ASP.NET running as NT AUTHORITY acct.

2) For all the logins above I’ve added them as users to the database and given dbo role.

I still get same login for user null error when attempting to connect from my XP workstation.

Can anyone help?

Hi,

You need to authenticate against the remote SQL server. Do that in your connectionstrong.

Check www.connectionstrings.com

Regards

|||

Thanks, I'm still getting error. I also want to state I am using windows authentication for this web application, and my understanding is ASP.NET is running as NT AUTHORITY (if windows 2003 and IIS 6) or ASPNET(if XP ) is this a correct assumption?My web.config is set to windows authentication.

I looked at connectionstrings.com as you suggested. This is the connection stringI auto created (it seems very consistent w/ examples on connectionstrings.com) using VisualStudio by dragging a table onto a form from the remote server "TESTSERVER" and using the Configure Data Source dialog which creates the connection string automatically. The SQL Database on TESTSERVER is set to mixed mode for both SQL and Windows authentication. Here is the string, do you see any issues?

Data Source=TESTSERVER;Initial Catalog=CompanyDB1;Integrated Security=True.

I get the same error :Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

Do you have any ideas on what I'm doing wrong? Why is user null? Should the user be ASPNET or NT AUTHORITY coming from my XP based web server?

|||Where is the SQL server located in?|||

The SQL Server 2000 database is located remotely on machine called TESTSERVER. This is what is in the connection string

(PS - When I want to point locally to my machine "PUU304" I use this connection string which works fine on my machine

connectionString="Data Source=PUU304;Initial Catalog=JBLocalDatabase;Integrated Security=True")

|||Well, using windows authentication for your winxp login is not working. Try to create a user/pass for your database on the remote server|||check the permission of your database|||NT AUTHORITY has dbo rights in the database. Is this the permission you are referring to?

No comments:

Post a Comment