From scratch, I made a new solution with two projects: one was MVC 3, and the other was an EF 4.2 supporting project. All this is being built successfully. From the MVC project, I open the "Add Controller" dialog and generate code based on the context and model that I select from the supporting EF project. The "add controller" dialog ends with the message:
Unable to retrieve metadata for "MyModelClass". Failed to initialize configuration system.
I noticed that the “add controller” dialog is actually trying to get the database connection string from the web.config file. Firstly, it looks like goofy-ish, since the supporting EF project already has app.config with a connection string. But, ignoring this, the best thing I can understand is that the connection string in web.config is bad. It looks like this:
<add name="Monsters2Entities" connectionString=" metadata=res://*/Monsters.csdl| res://*/Monsters.ssdl| res://*/Monsters.msl; provider=System.Data.SqlClient; provider connection string=" data source=.; initial catalog=Monsters2; integrated security=True; pooling=False; multipleactiveresultsets=True; App=EntityFramework "" providerName="System.Data.EntityClient" />
There are virtually no ridiculous line breaks and indents in the connection string — I'm just trying to make it easier to read. In any case, this connection string is basically identical to the connection string used in the supporting EF project on which it is being modeled. How do I fix this to make the add controller dialgoue happy?
visual-studio asp.net-mvc entity-framework
Brent Arias Nov 23 '11 at 7:55 2011-11-23 07:55
source share