문제

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 located 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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top