1

I am developing an ASP.NET MVC3 application using,

  1. MS SQL Server Pro 2008
  2. MS VS 2010 pro
  3. Entity FrameWork as model class.

When i start ASP.NET Web Site Administration Tool by clicking ASP.NET Configuration from solution explorer, in Security tab it shows an error:

Unable to connect to SQL Server database.

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config has a connection string as,

<connectionStrings>
        <add name="LocalSqlServer" connectionString="data   source=.\MSSQLSERVER;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>

I opened the C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regsql.exe and configure the database default named 'aspnetdb'. But situation is not being improved. So, would you please help me to solve it. Thank you.

arefinsami
  • 363
  • 2
  • 7
  • 18
  • is your MSSQLSERVER service started? Check to see if default port 1433 is open to connect with ms sql management tool. Usually that service starts late than iis – radu florescu Oct 06 '12 at 13:50

1 Answers1

0

Have you tried the database server that Visual Studio attempts to use?

It should match the one specified in your web.config file.

To check to go: Tools -> Options -> Database Tools -> Design-time Validation Database.

You can then change the SQL Server instance which is used.

James
  • 983
  • 1
  • 9
  • 17
  • yea, the default instance was SQLEXPRESS. i changed it to MSSQLSERVER. but, nothing happened. – arefinsami Oct 06 '12 at 12:43
  • You mention that the connection string is in machine.config, does your application have its own web.config file? Also have you checked that the MS SQL service is running? – James Oct 06 '12 at 13:59