Sql-server – Connection String for MS SQL Server 2008 using Windows Authentication

iis-7.5sql serverwindows-server-2008-r2

MS SQL Server and the web application are both on the same machine.

In web.config, I have:

connectionString="
   Server=COMPUTER_NAME\MSSQLSERVER;
   Database=MyDatabase;
   Integrated Security=true"
name="ApplicationServices"
providerName="System.Data.SqlClient"

I created a new Windows user account named MyWebsite. This account is assigned to application pool and my web application is using it.

In SQL Server Management Studio:

  • MyWebsite account is added in Security -> Logins
  • MyWebsite account is added in MyDatabse -> Security -> Users.
  • db_owner option is checked

In SQL Server Security Manager, all protocols are allowed.

I'm still getting the following error message:

 A network-related or instance-specific error occurred while establishing a connection to SQL Server'
 Error 26 - Error Locating Server/Instance Specified

Am I missing something?

Best Answer

You don't need to specify the instance name when you're connecting to the default instance.

Just use COMPUTER_NAME for the server.