简体   繁体   English

ASP.NET WEb.config引用程序集

[英]ASP.NET WEb.config Referencing an assembly

Hi I have 3 lines of code generated in my Web.config (.net 4.0) project as below 嗨,我在Web.config(.net 4.0)项目中生成了3行代码,如下所示

<configSections>
      <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral,PublicKeyToken=31bf3856ad364e35" requirePermission="false" />
</configSections>

When I run the project I get the error
: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

However I am referencing that assembly Microsoft.Practices.EnterpriseLibrary.Data from a private folder where it may not have a strong name etc in the project(I do Add references,Browse to private folder and add the Microsoft.Practices.EnterpriseLibrary.Data library). 但是我从私有文件夹中引用该程序集Microsoft.Practices.EnterpriseLibrary.Data,在项目中它可能没有强名,等等(我确实添加了引用,浏览到私有文件夹并添加了Microsoft.Practices.EnterpriseLibrary.Data库)。

I hope I can find the added library somewhere in project configuration(No idea where - I searched properties etc. So I can substitute that value without strong name etc in Web.config and get going. Can somebody give a hand ? 我希望我可以在项目配置中的某个地方找到添加的库(不知道在哪里-我搜索了属性等。因此我可以在Web.config中不用强名称等替换该值,然后继续。有人可以帮忙吗?

thanks 谢谢

Open a new project and try adding the references via NuGet and compare your config entries. 打开一个新项目,然后尝试通过NuGet添加引用并比较您的配置条目。

You just have the wrong version of the assembly referenced. 您只是引用了错误的程序集版本。

I found there was a problem in my connect string . 我发现连接字符串存在问题。 I was having a connection for SQL Server Compact and I did not have the providename. 我正在连接SQL Server Compact,但没有提供名称。 This was leading to problems. 这导致了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM