Unable to load the specified metadata resource

Posted xsj1989

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Unable to load the specified metadata resource相关的知识,希望对你有一定的参考价值。

本地运行都正常,就是发布到服务器上不行,查找了一些文章,都没解决我的问题,后来发现是路径不对和文件缺失。

原来的配置文件中是这样的:

<add name="TRidentityEntities" connectionString="metadata=res://*/TRidentityModel.csdl|res://*/TRidentityModel.ssdl|res://*/TRidentityModel.msl;provider=mysql.Data.MySqlClient;provider connection string=&quot;server=localhost;user id=root;password=xxxxxx;persistsecurityinfo=True;database=xxxxxx;Character Set=utf8&quot;" providerName="System.Data.EntityClient" />

修改一下:

<add name="TRidentityEntities" connectionString="metadata=~/bin/TRidentityDB\TRidentityModel.csdl|~/bin/TRidentityDB\TRidentityModel.ssdl|~/bin/TRidentityDB\TRidentityModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=localhost;user id=root;password=xxxxxx;database=xxxxxx;Character Set=utf8&quot;" providerName="System.Data.EntityClient" />

.csdl/.ssdl/.msl这三个文件你编译的时候会在你项目的bin目录中,copy过来就行了。

以上是关于Unable to load the specified metadata resource的主要内容,如果未能解决你的问题,请参考以下文章