0

I have a solution (WCF service) that has many Entity Framework modules in it. Each dll is named differently.

When I (and my co-workers) run this locally it all works fine. When we run the auto build and copy the files to a Dev Server it all works fine.

But when we copy the files to a Test Server I get an error:

Resolution of the dependency failed, type = "OrderManagementInterfaces.IOrderModel", name = "(none)".  
Exception occurred while: Calling constructor OrderDAL.OrderEntities(System.String connectionString).  
Exception is: MetadataException - Schema specified is not valid. Errors: 
OrderDataModel.csdl(3,4) : error 0019: The EntityContainer name must be unique. An EntityContainer with the name 'OrderEntities' is already defined.

It then follows with all the parts of my schema saying that each was already defined. When I first got this error it was the same kind of error but for a different Entity Framework module. (Not sure if that is important or not.)

So my question is: Is there an IIS Setting that could cause this? Why would it work in my dev server and not my test server?

And what can I do to fix it.

NOTE: I have checked many times to see if I have a duplicate module or container name. There is only one module and container named OrderEntities.

I saw that sometimes this is a product of the metadata part of the connection string. My Connection String looks like this:

metadata=res://*/OrderDataModel.csdl|res://*/OrderDataModel.ssdl|res://*/OrderDataModel.msl;provider=...

All the others are the same except the Data Model name is different.

Note: when I deploy to IIS. I delete all files and only copy in the stuff from the auto build. (Same stuff to both locations.)

Vaccano
  • 78,325
  • 149
  • 468
  • 850
  • possible duplicate of [C# - Entity Framework - The EntityContainer name must be unique. An EntityContainer with the name 'Entities' is already defined](http://stackoverflow.com/questions/2060278/c-sharp-entity-framework-the-entitycontainer-name-must-be-unique-an-entityc) – Craig Stuntz Mar 01 '12 at 15:51
  • @CraigStuntz - the answer on that one was "Your two EDMX files probably have the same entity container name" I clearly state in my question that is not the case for me. – Vaccano Mar 01 '12 at 15:55
  • No, you state that your module names are different. You don't say that the container names are different. Those are two different things. – Craig Stuntz Mar 01 '12 at 16:04
  • @CraigStuntz - Updated my question to reflect the fact that the module and container are uniquely named. – Vaccano Mar 01 '12 at 16:19
  • I still think you have duplicate container names but haven't found them yet. Probably only in an assembly on your test server, which would explain why you can't find it in source code. This error message is pretty unambiguous. Having said that, this is a good example of why using * in an EF connect string is a bad idea in non-trivial applications. Better to specify a specific assembly. – Craig Stuntz Mar 01 '12 at 18:09
  • I had the same issue but it seems it was due to having some old files in my bin or obj folder that visual studio wasn't cleaning. I deleted everything in bin and obj folders, performed a rebuild and everything was fine again. – Chris Oct 31 '12 at 10:35

1 Answers1

0

Turns out it was nothing to do with my code.

I had my Identity in my App Pool incorrectly set. Once that was switched to the right value, it all started working :)

Vaccano
  • 78,325
  • 149
  • 468
  • 850