[转]:No connection string named ‘AnyEntities’ could be found in the application config file
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.
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:
The Entity Framework is part of the infrastructure project and in its App.Config file, there is an entry of connection string as follows:
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
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步