While working on an ASP.NET MVC application I encountered the following error. It clearly says that some connection string is missing in the configuration file.

clip_image002

Well I have refactored the application following the onion architecture and there is nothing related to database exist in the MVC project. Project structure looks like follows:

clip_image004

The Entity Framework is part of the infrastructure project and in its App.Config file, there is an entry of connection string as follows:

clip_image006

Even though connection is present in the project which is dealing with the database, error is thrown. The reason behind this is, the MVC project is a startup project and the infrastructure project is not a startup project. We need to have connection string in the configuration file of the startup project. In this case startup project is MVC project, so to solve this error we need to copy IndiaMP connection string to Web.config of MVC project. After doing that you should not get the above error.

Solution: Copy connection string to configuration file of startup project.

Happy Coding

Advertisements

One thought on “No connection string named ” could be found in the ASP.NET MVC application config file: Solved

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s