Unable to retrieve metadata while adding controller scaffolding in MVC5.
Actually I really got the the exact error message while I am trying to add a controller scaffolding in MVC5.
Unable to retrieve metadata for 'CRM.DAL.Blog'. No connection string named 'BlogsEntities' could be found in the application config file.'
First of all for this above problem we have lots of reason/solutions but for me this below solutions works for me .
So I checked both entity framework config file and application config file and from there itself I got the reason why I was getting the error.
Actually I had the same content in the both the connection string but have different connection string name. It was resolved my issue .
This was content for App.config file .
<add name="BlogsEntities" connectionString="metadata=res://*/Blogs.csdl|res://*/Blogs.ssdl|res://*/Blogs.msl;provider=System.Data.SqlClient;provider connection string="data source=BIMALN4567\SQLSRV16;initial catalog=Blogs;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
This was content for Web.config file .
<add name="BlogsEntities123" connectionString="metadata=res://*/Blogs.csdl|res://*/Blogs.ssdl|res://*/Blogs.msl;provider=System.Data.SqlClient;provider connection string="data source=BIMALN4567\SQLSRV16;initial catalog=Blogs;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
Unable to retrieve metadata for 'CRM.DAL.Blog'. No connection string named 'BlogsEntities' could be found in the application config file.'
First of all for this above problem we have lots of reason/solutions but for me this below solutions works for me .
So I checked both entity framework config file and application config file and from there itself I got the reason why I was getting the error.
Actually I had the same content in the both the connection string but have different connection string name. It was resolved my issue .
This was content for App.config file .
<add name="BlogsEntities" connectionString="metadata=res://*/Blogs.csdl|res://*/Blogs.ssdl|res://*/Blogs.msl;provider=System.Data.SqlClient;provider connection string="data source=BIMALN4567\SQLSRV16;initial catalog=Blogs;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
This was content for Web.config file .
<add name="BlogsEntities123" connectionString="metadata=res://*/Blogs.csdl|res://*/Blogs.ssdl|res://*/Blogs.msl;provider=System.Data.SqlClient;provider connection string="data source=BIMALN4567\SQLSRV16;initial catalog=Blogs;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
So now you can see the difference .
Comments
Post a Comment