views:

36

answers:

2

We just recently switched from Visual Studio 2008 to Visual Studio 2010. I have an application which uses sql express database locally. The problem is after installing new Visual Studio, I can't access the Sql Server 2008 express. When I try to create a new database, or change the existing one, I get following message:

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 and that SQL Server is configured to allow remote connections. (provider: TCP Provider, Error 0 - No connection could be made because target machine is actively refused it.)

When I check the sqlexpress windows service, it is stopped. If I try to enable it, it runs for a few seconds and then stops again.

+1  A: 

Have a look at the error logs, in

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\

There should be files called ERRORLOG and ERRORLOG.X the latest one should give you an indication why the service failed to start.

They are plain text files and can be opened in Notepad.

Edit Your error is at the bottom

2010-07-20 16:05:59.54 spid7s      Cannot create file 'c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\temp_MS_AgentSigningCertificate_database.mdf' because it already exists. Change the file path or the file name, and retry the operation.

So try renaming the file c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\temp_MS_AgentSigningCertificate_database.mdf and start the service again.

If it fails, then look in that file (it should be a new one) in Notepad to see if there are any new errors.

Chris Diver
Here is the content of the file:http://rapidshare.com/files/408004229/ERRORLOG
Bogi
Edited post with further instructions.
Chris Diver
A: 

remove sql express completly. Then reinstall the latest sql express version

David
this worked, but not entirely. I also had to delete directory with sql master table.
Bogi