发表评论
#2楼 [
楼主]2005-10-19 11:33 |
TO:yiyegufan
谢谢,我会继续写的:)
你好,我今天开始学习DAAB,我的步骤和你上面所述的差不多,我用的entlib是June2005,我在使用过程中遇到了问题:
未处理的“System.Configuration.ConfigurationException”类型的异常出现在 microsoft.practices.enterpriselibrary.configuration.dll 中。
其他信息: Invalid section name. The section 'dataConfiguration' does not exist in the requested configuration file 'F:\my project\Entlib\DataAccess\bin\Debug\DataAccess.exe.config' or the file 'c:\winnt\microsoft.net\framework\v1.1.4322\Config\machine.config'. Make sure that the 'enterpriseLibrary.configurationSections' configuration section exists in one of the files and that the section 'dataConfiguration' is defined.
我的项目下有App.config和dataconfiguration.config文件,请问这是什么问题。
#4楼 [
楼主]2005-10-24 12:04 |
TO:adow
你看一下你的App.config和dataconfiguration.config文件在你的这个路径下面有吗?
F:\myproject\Entlib\DataAccess\bin\Debug
您好
我昨天准备开始写Enterprise Library的全部
今天看到你已经写了这么多了
而且写得很不错
我支持你 我就不写了 请问我可以引用您的文章吗
写大太好了
#6楼 [
楼主]2005-10-27 11:13 |
To:高海东
多谢支持:)
当然可以了,你可以随便引用
版权没有^_^
#8楼 [
楼主]2005-11-03 12:16 |
@BrianXue
多谢支持:)
我在使用数据应用程序块时,出现了异常。不知道该怎么解决,求教。
如下:
安全性异常
说明: 应用程序试图执行安全策略不允许的操作。要授予此应用程序所需的权限,请与系统管理员联系,或在配置文件中更改该应用程序的信任级别。
异常详细信息: System.Security.SecurityException: 不允许所请求的注册表访问权。
#10楼 [
楼主]2005-11-30 08:09 |
@凌风_314
首先检测一下你在配置数据访问应用程序块时,连接字符串Sql Connection String的配置是否和你SQL Server服务器一致
我在connection.open的时候出现异常了,仅仅提示系统异常,我想可能也跟连接字符串有关,但不知道怎么改。
我找到问题了,晕,楼主配server的时候怎么能配成local,应该为(local),这样连接字符串才能对,楼主写文章要测试一下呀。
#13楼 [
楼主]2005-11-30 15:52 |
@栖息的熊
不好意思啊
我做例子的时候用的是机器名,后来截图时用了local
没想到害了你^_^
实在不好意思啊
/**//// <summary>
12 /// 返回DataReader类型
13 /// </summary>
14 /// <returns></returns>
15 private DataReader GetDataReader()
16 {
17 DataReader dr = db.ExecuteReader(CommandType.Text,"SELECT * FROM Employees");
18
19 return dr;
20 }
dr需要dr.close()吗?
11.在项目中选择 属性|生成事件|生成后事件命令行 输入如下内容:
copy "$(ProjectDir)\*.config" "$(TargetDir)"
=================
我的不需要这一步的. 我的是june 2005
自动在项目下生成dataconfiguration.config文件.
@ Terrylee
我也遇到了和 凌风_314 一样的问题,我仔细检查了连接字符串,下面是dataconfiguration.config的配置
<connectionString name="Sql Connection String">
<parameters>
<parameter name="database" value="formtest" isSensitive="false" />
<parameter name="Integrated Security" value="True" isSensitive="false" />
<parameter name="Pwd" value="" isSensitive="true" />
<parameter name="server" value="(local)" isSensitive="false" />
<parameter name="User ID" value="sa" isSensitive="false" />
</parameters>
</connectionString>
这样总是提示 凌风_314 提到的错误
我自己设置这样的连接字符串能连到数据库
<appSettings>
<add key="SQL_Connection" value="data source=(local);persist security info=False;initial catalog=formtest;User ID=sa;PWD=;" />
</appSettings>
我是新手,真的很崩溃,不知道那里有问题,请达人赐教!!!!
@凌风_314
请问你提到的问题解决了吗?
================= =================
我在使用数据应用程序块时,出现了异常。不知道该怎么解决,求教。
如下:
安全性异常
说明: 应用程序试图执行安全策略不允许的操作。要授予此应用程序所需的权限,请与系统管理员联系,或在配置文件中更改该应用程序的信任级别。
异常详细信息: System.Security.SecurityException: 不允许所请求的注册表访问权。
晕加密后更本不知道把* .config放到哪里去...
我也出现这样的问题呀??没人能解决吗???
如下:
安全性异常
说明: 应用程序试图执行安全策略不允许的操作。要授予此应用程序所需的权限,请与系统管理员联系,或在配置文件中更改该应用程序的信任级别。
异常详细信息: System.Security.SecurityException: 不允许所请求的注册表访问权。
#20楼 [
楼主]2006-04-06 13:05 |
TO 各位:
我在我这儿试了一下,没有浮现出这个错误。
我觉得问题应该是处在配置文件上,如果SQL Server验证使用的用户名和密码,则在配置时只提供四个参数:Server,Uid,Pwd,Database,把那个Integrated Security的选项删除。
再试试看!
你好。你写得不错。
我想请问一下。以你现在的水平能找到多少钱一个月的工作
。你是我的奋斗目标。谢谢
#23楼 [
楼主]2006-05-08 16:29 |
@lw
谢谢你的支持!
这已经是第二个有人在Blog上这样问我了,这个问题不适合在这里问吧??
哈哈,我很佩服你.我真的很想知道啊
那你可以你发到我的信箱里面去啊,我真的很想知道我的水平和我的价值啊
lw@ftd-asia.com.cn
#25楼 [
楼主]2006-05-09 08:32 |
@lw
这个问题还是不要谈的好,一个人的水平和价值不能简单的用工资来衡量吧?
如果你有兴趣,可以加我的MSN,Blog左边有!
异常详细信息: System.Data.SqlClient.SqlException: 用户 'CICA\ASPNET' 登录失败。
出现这种情况是怎么回事啊?
您好,当我将使用EntLib得DAAB的项目部署到2003的机器上是出现的下面的错误
[Win32Exception (0x80004005): Access is denied]
[InvalidOperationException: Cannot open log for source {0}. You may not have write access.]
System.Diagnostics.EventLog.OpenForWrite() +363
System.Diagnostics.EventLog.WriteEvent(Int32 eventID, Int16 category, EventLogEntryType type, String[] strings, Byte[] rawData) +280
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) +462
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category) +21
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID) +15
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type) +11
Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.PerformanceCounterInstances.ReportCounterFailure(String message)
[InvalidOperationException: Exception in ReportCounterFailure("Failed to create instances of performance counter '# of Command Failures/Sec' - Couldn't get process information from remote machine..". Here's the debugging trace...Start;new EventLog('Application', '.', 'Enterprise Library Instrumentation');]
Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.PerformanceCounterInstances.ReportCounterFailure(String message)
Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.PerformanceCounterInstances..ctor(String categoryName, String counterName, Boolean createNewInstance)
Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentedEvent.AddPerformanceCounter(String category, String[] counterNames, Boolean createNewInstance)
Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentedEvent.Initialize(String counterCategory, String[] counterNames, Boolean createNewInstance, String eventLogSource, EventLogIdentifier[] eventIds)
Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.InstrumentedEvent..ctor(String counterCategory, String[] counterNames, Boolean createNewInstance)
Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataServiceEvent..ctor(String[] counterNames)
Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataCommandFailedEvent..ctor(String[] counterNames)
Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataCommandFailedEvent..cctor()
[TypeInitializationException: The type initializer for "Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataCommandFailedEvent" threw an exception.]
Com.Benday.Search.SearchDA.Execute(SearchDefinition search)
Com.Benday.Search.SearchManager.Execute(SearchDefinition search)
Timesheet.WebUI.Global.InitializeValues(String searchName, String storeAsKey) in c:\inetpub\wwwroot\Timesheet.WebUI\Global.asax.cs:50
Timesheet.WebUI.Global.InitializeLookupValues() in c:\inetpub\wwwroot\Timesheet.WebUI\Global.asax.cs:30
Timesheet.WebUI.Global.Application_BeginRequest(Object sender, EventArgs e) in c:\inetpub\wwwroot\Timesheet.WebUI\Global.asax.cs:79
System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +60
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87
请问如何解决啊?我试了很多办法,都没有办法解决!谢谢
我用Enterprise Library June 2005,在.net 2003重访问SQL Server 2000没有问题,
但是在 .net 2005中访问SQL Server 2000,提示guset匿名访问失败。
是不是版本的问题啊?
Integrated Security参数设置为false就可以了,呵呵
#31楼 [
楼主]2006-11-18 17:50 |
@吴娟
呵呵,名字跟我大学同学同名
不好意思,这几天有事,回复的晚了:)
虽然是VC的,但我用VB2005终于写成功了,只是我的Enterprise Library - January 2006的,科技日新月异呀!
#34楼 [
楼主]2006-11-28 09:49 |
@天涯海角[匿名]
Enterprise Library v3已经在研发中了:)
我就是你大学同学咯。组长嫌我学得不够好,要我再学一遍,所以我又跑来啦。。
#36楼 [
楼主]2006-11-28 12:00 |
@吴娟
真的?
热烈欢迎,呵呵
发邮件给我吧,把你的MSN告诉我,Blog右边有邮箱:)
int iCount = db.ExecuteScalar(CommandType.Text,"SELECT COUNT(*) FROM Employees");
请问ExecuteScalar返回值的是object类型吧?
I get an error message as "The type initializer for "Microsoft.Practices.EnterpriseLibrary.Data.Instrumentation.DataCommandFailedEvent" threw an exception.". I don't know what's problem to the enterprise library. Is it security problem? Can somebody help me to solve this problem? Thanks.
我怎么每次配置都不成功 说原文件与模块生成文件不相同
我现在用的工具是vs2005,我需要测试的是一个方法的返回值dataset.
方法实现如下
public DataSet GetAllCategory()
{
Database db = DatabaseFactory.CreateDatabase();
DataSet dsCategory = new DataSet();
string sqlcommand="select * from Categories";
DbCommand dbcommand = db.GetSqlStringCommand(sqlcommand);
db.LoadDataSet(dbcommand, dsCategory, "Categories");
return dsCategory;
}
我使用vs2005带的功能进行单元测试测试方法如下 /// <summary>
///GetAllCategory () 的测试
///</summary>
[DeploymentItem("DataAccess.dll")]
[TestMethod()]
public void GetAllCategoryTest()
{
Category category = new Category();
int expected = 0;
DataSet actual;
actual = category.GetAllCategory();
Assert.AreNotEqual(expected, actual.Tables[0].Rows.Count, "DataAccess.Category.GetAllCategory 未返回所需的值。");
}
结果测试失败.
我运行的vs的debug程序,发现程序一切正常也就是说GetAllCategory()这个方法肯定是没有错的.我debug我的单元测试程序发现 actual = category.GetAllCategory();这一步骤有错误.进一步发现在运行单元测试的时候根本无法获取到数据库连接字符串也就连不上数据库.只有把字符串写到类里面才能运行正常,写到webconfig中是读取不到的.这个问题我实在没明白为什么.
另外我的数据库层用的是enterprise3.0里面的daab所以绝对是没问题的.但不知道为什么单元测试的时候程序不能动态的从webconfig中读取到数据连接字符串呢,大家在进行单元测试的时候又是怎么测试数据库dataset这样的对象呢?请指教
請問:為什麽数据库的名称和数据库實例的名称一樣啊?他們有什麽區別啊?
#43楼 [
楼主]2008-03-10 14:31 |
@Landylee
可以用不一样的啊,这个实例名是用来你在代码中创建Database时用的:)
Database db = DatabaseFactory.CreateDatabase("NorthWind");
为什么会说找不到类型或命名空间名称“Database”(是否缺少 using 指令或程序集引用?)
@菜啊
你添加dll引用了和“
using Microsoft.Practices.EnterpriseLibrary.Caching;
using Microsoft.Practices.EnterpriseLibrary.Caching.Expirations;
using Microsoft.Practices.EnterpriseLibrary.Data;
”吗?如果加了还有这样的错,那就是你添加dll引用没有加对位置。
Invalid section name. The section 'dataConfiguration' does not exist in the requested configuration file 'C:\Inetpub\wwwroot\WebTest\web.config' or the file 'C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Config\machine.config'. Make sure that the 'enterpriseLibrary.configurationSections' configuration section exists in one of the files and that the section 'dataConfiguration' is defined.
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Configuration.ConfigurationException: Invalid section name. The section 'dataConfiguration' does not exist in the requested configuration file 'C:\Inetpub\wwwroot\WebTest\web.config' or the file 'C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Config\machine.config'. Make sure that the 'enterpriseLibrary.configurationSections' configuration section exists in one of the files and that the section 'dataConfiguration' is defined.
源错误:
行 43: // results.Append('\t');
行 44: // results.Append(configData.ToString());
行 45: Database db = DatabaseFactory.CreateDatabase("NorthWind");
行 46: DataSet ds = db.ExecuteDataSet(CommandType.Text, "SELECT * FROM Employees");
行 47:
源文件: c:\Inetpub\wwwroot\WebTest\Default.aspx.cs 行: 45
我是按照你说的方法去做了,出现这个错误,我们文件'C:\Inetpub\wwwroot\WebTest\下有web.config' 和'dataConfiguration' 这二个文件,楼主是什么错误,我用的是VS2005,Enterprise Library June 2005