WebService cannot connect to a remote SQL Database.
I have an ASP.NET Web Service and I’m trying to connect to a database on a remote machine (MS SQL Server on 2003 Windows Server machine). I added a ASPNET account to Windows and to SQL Server but it doesn’t work and gives me an exception: “Server doesn’t exist or access denied”.
At the same time I can easily connect to this database from a regular C# application.
Please help!!!
Re: WebService cannot connect to a remote SQL Database.
Check your connect string. Remember that a [web]service doesn't run as a typical user account. Your normal app may work due to you being logged in and running the db connection off your credentials. For ASP.NET, it's typically the ASP.NET account or the NETWORK SERVICE, or possibly LOCALSYSTEM depending on your setup. Otherwise, use SQL Authentication.