尝试配置企业库5.0(数据访问应用程序块)时出现问题 [英] Problem when trying to configure enterprise library 5.0 (Data Access Application Block)
问题描述
尝试从企业库5.0运行DAAB时遇到一些问题。我已经按照教程中的步骤进行操作,但是却出现了错误...
I am running into some problems while trying to get DAAB from Enterprise library 5.0 running. I have followed the steps as per the tutorial, but am getting errors...
1)下载/安装企业库
1) Download / install enterprise library
2)添加对我需要的块的引用(公共/数据)
2) Add references to the blocks I need (common / data)
3)导入
Imports Microsoft.Practices.EnterpriseLibrary.Common
Imports Microsoft.Practices.EnterpriseLibrary.Data
4)通过企业库配置软件。我从站点打开web.config。然后,我单击块,然后单击添加数据设置...,填写我的详细信息并保存/关闭
4) Through the enterprise library config software. I open up the web.config from my site. I then click Blocks, then Add data settings... fill in my details and save / close
5)然后,我(认为安装已完成)尝试获取实例通过
5) I then (thinking setup is complete) try to get an instance of the database via
Dim db As Database = DatabaseFactory.CreateDatabase()
6)我编译并收到以下错误:
6) I compile and receive the following error:
无法加载文件或程序集'Microsoft .Practices.EnterpriseLibrary.Data,版本= 5.0.414.0,文化=中性,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。 (来自HRESULT的异常:0x80131040)(C:\site\web.config第4行)
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) (C:\site\web.config line 4)
我的web.config的第4行是由配置工具生成的,是:
Line 4 off my web.config was generated by the config tool and is:
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
我错过了必需的步骤吗?我是否以错误的顺序完成了步骤?我犯错了吗?
Am I missing a required step? Have I done the steps in the wrong order? Have I made a mistake?
非常感谢您的帮助。
推荐答案
答案:
我不小心引用了src代码文件夹中的程序集。这意味着公共令牌将具有= null。我重新引用了C:\Program Files\Microsoft Enterprise Library 5.0\Bin中的程序集,该问题现在已解决。
I had accidentaly referenced the assemblies from the src code folder. Which means the public tokens would have = null. I re-referenced to the assemblies in C:\Program Files\Microsoft Enterprise Library 5.0\Bin and the problem is now solved.
这篇关于尝试配置企业库5.0(数据访问应用程序块)时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!