ASP.NET Web Api: Project requires SQL Server Express

user437899 picture user437899 · Dec 4, 2012 · Viewed 26.8k times · Source

I created a Web API project under VS 2010. After I switched to VS 2012, I always get a warning:

The Web project 'xxx' requires SQL Server Express, whcih is not installed on this computer. [...]

I do not want to install this SQL Server Express. I use IIS for debugging. How can I disable this dependency?

I noticed also this in my web.config:

<connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|[...].mdf;Initial Catalog=[...];Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
  </connectionStrings>

Who created this? Can I delete this?

Answer

Stevodevo picture Stevodevo · Sep 5, 2013

Change this part of the connection string "Data Source=.\SQLEXPRESS" to

"Data Source=localhost\SQLEXPRESS"