We have a solution which consists of two projects - a console application project and a web application project. Each of these has an identical in schema, but differently named .edmx file used to access the same database.
The console application runs as a scheduled task on the same server as the web application is hosted. The web application contains a reference to the console application as certain actions within the web application lead to methods in the console application being called. This combination has been running in our staging environment successfully for many months.
When released live we are seeing the following error message at least once a day:
Schema specified is not valid. Errors:
ProjectName.csdl(3,4) : error 0019: The EntityContainer name must be unique. An EntityContainer with the name 'ProjectEntities' is already defined. ProjectName.csdl(63,4) : error 0019: Each type name in a schema must be unique. Type name 'ProjectModel.DataSource' was already defined. ProjectName.csdl(75,4) : error 0019: Each type name in a schema must be unique. Type name 'ProjectModel.Error' was already defined.
This continues, listing all the type names in our schema.
This error can be fixed by recycling the application pool or restarting IIS.
Please note that the error does not occur until the web application has been running for a while - it is not occuring when we compile or the first time we access the application.
My initial theory was that the two Entity Containers are conflicting with each other because the web application references the console application, but they have different names, which makes the error "The EntityContainer name must be unique. An EntityContainer with the name 'ProjectEntities' is already defined" confusing.
In the GUI designer, open Model Browser. Look for a node that says "EntityContainer: Entities". Click it. In Properties, change Name to something else.
An entity container is a logical grouping of entity sets, association sets, and function imports. The following must be true of an entity container defined in a conceptual model: At least one entity container must be defined in each conceptual model.
Go to that bin folder and delete dll and pdb file manually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With