views:

32

answers:

1

I am getting following error while connecting to my local Sql Express:

An error has occurred. Details of the exception:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Unable to connect to SQL Server database.

I am able to connect to Sql Server using Management Studio.

I am using aspnet_regiis to generate the Session state database using the following command.

aspnet_regsql.exe -ssadd -sstype c -d App_SessionState -S [.\SQLEXPRESS] -U [USERiD] -P [Password]
A: 

Is your database in Windows or mixed mode authentication? To login using a user id and password the server needs to be in mixed mode authentication.

To check this, in Management Studio:

 1. Right click the server name in the Object Explorer tree on the left and select Properties.
 2. Click Security.
 3. Under Server authentication select SQl Server and Windows Authentication Mode.
 4. Click OK
 5. You need to restart SQL Server, so right click the server name again and select Restart.
JonPayne