使用Data Access Application Block遇到的问题

1、这是个来自 http://blog.hishambaz.com/archive/2005/01/29/194.aspx 的问题,这个问题是出在选择解决问题的方式上。大家有人遇到过吗,是Bug吗?

When trying the data access application on my own project does not find the configurationData somehow it goes and read the Machine.config from the .net framework dir in winnt. I have the dataConfiguration.config in my debug dir.

Additional information:
    Invalid section name. The section 'dataConfiguration' does not exist in the requested configuration file 'C:\workdir\dbproj\dbWinApp3\bin\Debug\dbWinApp3.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.
 
The solution that worked for me is as follow:
I copied dataConfiguration.config and App.config to my debug dir and renamed App.config as my executable dbWinApp3.exe.config and compiled my App afterward. To my suprise after compilation dbWinApp3.exe.config was getting deleted so I was getting the Invalid section name and not findig the enterpriseLibrary.configurationSections. So I change my dbWinApp3.exe.config file in my debug dir to readonly by right clicking on the file and selecing the readonly option. So it no longer got deleted after the compilation and it worked. There is a workaround this problem with doing a postbuildcommand in VStudio that after compilation copy the files to debug dir not before like the way I am doing. I have to look it up to see how it is done. I hope it works for you.

2、我尽量描述清我遇到的问题:
解决方案里有两个项目,DAL和UI。UI作为启动项目,DAL中有个使用DAAB调用存储过程的SalesData的类。UI中有两个自定义控件和一个启动窗体TestForm。A控件使用了SalesData的实例,B控件与EntLib无关。我使用“启动新实例”调试UI项目(之前并没有生成解决方案),A、B控件就出现在ToolBox里了,我将B拖入TestForm正常,但将A拖入则弹出错误,给出的信息类似上面那位老兄所遇到的,但是我这里是devnev.config和machine.config中没有声明‘dataConfiguration'!声明一点:我使用了POSTBUILD COMMAND,  而且使用B工作正常!(生成解决方案也是一样)

3、我认为在devenv.exe.config和machine.config中找’dataConfiguration.config',与在**.exe.config和machine.config中找配置信息是不同的问题。我会进一步搜索、研究的。

I appreciate any help!

P.S. 参看这位老兄遇到的问题:
    I'm getting an Invalid section name. error at design time when I try to open a control from another project that uses the caching block. Project A -ClassLibrary- has a control which uses caching block Project B-WebApp uses the control but when placed on the form shows ERROR CREATING CONTROL. Invalid Section Name.

posted @ 2005-06-16 15:49  sinlight23  阅读(2959)  评论(1编辑  收藏  举报