0

I can access the connection strings in my configs like so:

var connectionStrings = WebConfigurationManager.ConnectionStrings

All the connections in my config are there, but for some reason this list also contains some kind of SQLEXPRESS default string:

data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true

I don't have SQLExpress running on my machine, so of course this fails to connect when my app loops through each connection. Is there some setting somewhere which is causing this default string to appear in WebConfigurationManager.ConnectionStrings?

Searching for "SQLExpress" (ignore case) across the whole app returns zero results.

FBryant87
  • 4,273
  • 2
  • 44
  • 72
  • 1
    Configuration files are inherited. This connection string is somewhere in your machine.config or web.config in the Microsoft .NET installation directory, perhaps. – CodeCaster May 03 '18 at 09:43
  • Ah correct, I wasn't aware they could be pulled from outside the solution (it was in the installation directory) - thanks! – FBryant87 May 03 '18 at 09:44

0 Answers0