简体   繁体   中英

Entity Framework not using connection string in app.config

My error message states

The underlying provider failed on Open

and the InnerException states that the database cannot open by the requested login.

The strange thing is that my connectionString is showing a different login than what's mentioned in the error. Why is the application using an incorrect connectionString than the one that's explicitly defined in my App.Config?

Few common reasons why:

1) You aren't using that project as your StartUp Project

2) You didn't match the name in the config

<connectionStrings>
    <add name="YourContext"... >
</connectionStrings>

3) You are hard coding it in the YourContext.cs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM