How do I setup a WCF Data Service with an ADO.NET Entity Entity Model in another assembly?
I have an ASP.NET 4.0 website that has an Entity Data Model hooked up to WCF Data Service. When the Service and Model are in the same assembly everything works. Unfortunately, when I move the Model to another "shared" assembly (and change the namespace) the service compiles but throws a 500 error when launched in a browser. The reason I want to have the Model in a common assembly (lets call it RiaTest.Shared) is that I want share common validation code between the client and service (by checking "Reuse types in referenced assemblies" in the Advanced tab 开发者_运维知识库of the Add Service Reference dialog).
Anyway, I've spent a couple of hours on this to no avail so any help in the regard would be appreciated...
When you move the EF data model into its own assembly, you need to make sure to still have the EDM connection in your web.config where your WCF Data Service lives. Did you possibly remove that connection string??
I got the very same error after I referenced an EDM model in a separate assembly from a web application. Once I copied the EDM connection string from the model assembly to the web.config for the web application where my WCF Data Service lives, everything worked out just fine!
精彩评论