第一次使用微软的企业库就遇上麻烦
2005-11-24 03:20
232 查看
情况是这样的,看了一段时间的Enterprise Library后,终于决定不用原来的SQLHelper,改用Enterprise Library Data Access Application Block来代码原来的方案。在公司完成大部分工作,做了简单的测试,顺利执行。
可是在我觉得一切就绪的时候,在家里的机器上执行在公司写的测试代码的时候却发现执行的时候总是报告说
安全性异常
说明: 应用程序试图执行安全策略不允许的操作。要授予此应用程序所需的权限,请与系统管理员联系,或在配置文件中更改该应用程序的信任级别。
异常详细信息: System.Security.SecurityException: 不允许所请求的注册表访问权。
我家里的机器上没有装Enterprise Library,于是担心是不是跟这个有关,试着装了一下(June2005版),发现还是不行。
真是头大了,不会这么不顺利吧。于是上博客园寻求帮助,还好经过一番努力找到了解决办法,并测试成功。正面是主要步骤:
解决方案:
1、去掉这些代码。(这会是一个痛苦的经历,代码割舍不清呀)
2、给IUSR 帐户访问注册表的权限(安全问题呀!)
我们当然不推荐这2个做法:
我们推荐的做法:重新编译 Microsoft.Practices.EnterpriseLibrary.Common 项目,编译时把其中 Conditional Compilation Constants 设置中除 DEBUG;TRACE 外的其他项都去掉。
具体步骤:
1. Open Start->programs->MS Patterns and Practices -> Ent Lib -> App Blocks -> Ent Lib.Sln.
2. Take your own sweet time to minimize all the folder(s) in ur solution window.
3. Rt Clk on the “Common” project and go to “Properties”
4. In the “Configuration Properties” go to the “Build” option.
5. In the Conditional Build section of the property grid, remove everything except “DEBUG;TRACE”
6. Close everything and recompile.
Remember...on compilation nothing will go to your common bin folder. I just plainly used the “Copy Assemblies to bin directory” option in my Start->programs->MS Patterns and Practices -> Ent Lib part of my menu.
Now...just to be sure....de-reference your existing references to the entlib and add references again.....and woala.....you are done.
上面的英文比较简单,结合自己的环境注册对照一下就可以了。如果谁有问题,跟我联系。jianjunli80@gmail.com
希望其他人再遇到这个问题进不要再走弯路。
可是在我觉得一切就绪的时候,在家里的机器上执行在公司写的测试代码的时候却发现执行的时候总是报告说
安全性异常
说明: 应用程序试图执行安全策略不允许的操作。要授予此应用程序所需的权限,请与系统管理员联系,或在配置文件中更改该应用程序的信任级别。
异常详细信息: System.Security.SecurityException: 不允许所请求的注册表访问权。
我家里的机器上没有装Enterprise Library,于是担心是不是跟这个有关,试着装了一下(June2005版),发现还是不行。
真是头大了,不会这么不顺利吧。于是上博客园寻求帮助,还好经过一番努力找到了解决办法,并测试成功。正面是主要步骤:
解决方案:
1、去掉这些代码。(这会是一个痛苦的经历,代码割舍不清呀)
2、给IUSR 帐户访问注册表的权限(安全问题呀!)
我们当然不推荐这2个做法:
我们推荐的做法:重新编译 Microsoft.Practices.EnterpriseLibrary.Common 项目,编译时把其中 Conditional Compilation Constants 设置中除 DEBUG;TRACE 外的其他项都去掉。
具体步骤:
1. Open Start->programs->MS Patterns and Practices -> Ent Lib -> App Blocks -> Ent Lib.Sln.
2. Take your own sweet time to minimize all the folder(s) in ur solution window.
3. Rt Clk on the “Common” project and go to “Properties”
4. In the “Configuration Properties” go to the “Build” option.
5. In the Conditional Build section of the property grid, remove everything except “DEBUG;TRACE”
6. Close everything and recompile.
Remember...on compilation nothing will go to your common bin folder. I just plainly used the “Copy Assemblies to bin directory” option in my Start->programs->MS Patterns and Practices -> Ent Lib part of my menu.
Now...just to be sure....de-reference your existing references to the entlib and add references again.....and woala.....you are done.
上面的英文比较简单,结合自己的环境注册对照一下就可以了。如果谁有问题,跟我联系。jianjunli80@gmail.com
希望其他人再遇到这个问题进不要再走弯路。
相关文章推荐
- [EntLib]微软企业库5.0 学习之路——第九步、使用PolicyInjection模块进行AOP—PART4——建立自定义Call Handler实现用户操作日志记录
- [EntLib]微软企业库5.0 学习之路——第十步、使用Unity解耦你的系统—PART2——了解Unity的使用方法(3)
- 微软企业库4.1学习笔记(二十二)加解密模块2 在应用中使用加密解密
- [EntLib]微软企业库5.0 学习之路——第二步、使用VS2010+Data Access模块建立多数据库项目
- 微软企业库5.0 学习之路——第五步、介绍EntLib.Validation模块信息、验证器的实现层级及内置的各种验证器的使用方法——上篇
- 学习笔记附录:动软代码生成器和微软企业库的使用
- (转)[EntLib]微软企业库5.0 学习之路——第十步、使用Unity解耦你的系统—PART2——了解Unity的使用方法(1)
- 微软企业库5.0 学习之路——第十步、使用Unity解耦你的系统—PART2——了解Unity的使用方法(3)
- 微软企业库4.1学习笔记(十六)缓存模块4 服务器场中的缓存使用
- 微软企业库5.0 学习之路——第四步、使用缓存提高网站的性能(EntLib Caching)
- asp.net 事务的处理,dts 的设置,asp.net三种事务处理方法,三层架构,微软企业库,动软生成器生成的代码下如何使用事务
- 微软企业库--Policy使用Exception Handler
- 微软企业库4.1学习笔记(十四)缓存模块2 使用缓存模块进行开发
- 牛腩购物网 2:动软生成器和微软企业库的使用
- (转)[EntLib]微软企业库5.0 学习之路——第十步、使用Unity解耦你的系统—PART1——为什么要使用Unity?
- [EntLib]微软企业库5.0 学习之路——第十步、使用Unity解耦你的系统—PART2——了解Unity的使用方法(2)
- 微软企业库5.0 学习之路——第五步、介绍EntLib.Validation模块信息、验证器的实现层级及内置的各种验证器的使用方法——中篇
- 微软企业库5.0 学习之路——第六步、使用Validation模块进行服务器端数据验证
- 微软企业库5.0 学习之路——第九步、使用PolicyInjection模块进行AOP—PART1——基本使用介绍
- 使用微软企业库-缓存