开发者

Error reached after genereated entity framework classes by edmgen tool

First I read this question, but this knowledge did not help to solve my problems.

In initial I've created edmx file by Visual Studio. Generated files with names:

  • uqsModel.Designer.cs
  • uqsModel.edmx

This files are located on App_Code folder.

And my web app work normally. In Web Config generated connectionstring automatically.

<add name="uqsEntities" connectionString="metadata=res://*/App_Code.uqsModel.csdl|res://*/App_Code.uqsModel.ssdl|res://*/App_Code.uqsModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=aemloviji\sqlexpress;Initial Catalog=uqs;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" /></connectionStrings>

Then I had to generate classes by the instrument edmgen tool(full generation mode). Generated new files with names:

  • uqsModel.cs
  • uqsModel.csdl
  • uqsModel.msl
  • uqsModel.ssdl
  • uqsViews.cs

it save new classed to the folder where edmx files locat开发者_StackOverflowed before, and remove existing edmx files. And when page redirrects to any web page server side code fails. And problem: Unable to load the specified metadata resource.

Some idea, please.


The problem seems to be associated with the fact that you have generated metadata in the form of .csdl, .ssdl, and .msl files, and your connection string points to the resource that should be embedded to the project dll (which is likely to be unavailable in your Web Site).
The solution is to correct the path to metadata like the following:

metadata=~\App_Code\uqsModel.csdl|~\App_Code\uqsModel.ssdl|~\App_Code\uqsModel.msl

More information is available here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜