The specified named connection is either not found in the configuration

167 views Asked by At

As the title says I'm having issues connecting to my database with my application.

This is the error I am getting

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

And this is the code for it:

        public SaleswebEntities() : base("name=SaleswebEntities", "SaleswebEntities")
    {
        this.ContextOptions.LazyLoadingEnabled = true;
        OnContextCreated();
    }

And this is my Connection string.

  <connectionStrings>
<add name="SaleswebEntities" connectionString="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=Salesweb;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"
  providerName="System.Data.SqlClient" />

As fast as I can see I have no typo, might be worth to mention this is a MVC2 application.

1

There are 1 answers

2
B Wells On BEST ANSWER

Are you using a DSN? http://www.connectionstrings.com/dsn/:

Go here: %windir%\system32\odbcad32.exe and/or C:\Windows\SysWOW64\odbcad32.exe to add...