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=&quot;data source=BIMALN4567\SQLSRV16;initial catalog=Blogs;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" 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=&quot;data source=BIMALN4567\SQLSRV16;initial catalog=Blogs;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

So now you can see the difference . 

Comments

Popular posts from this blog

The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

The transaction is aborted or Failure while attempting to promote transaction.

Unable to load one or more breakpoints in Visual studio.