异常详细信息: System.Security.SecurityException: 不允许所请求的注册表访问权

推荐的做法:重新编译 Microsoft.Practices.EnterpriseLibrary.Common 项目,编译时把其中 Conditional Compilation Constants 设置中除 DEBUG;TRACE 外的其他项都去掉。

具体步骤:

1.
打开 开始 - 程序- Microsoft patterns & practices-Enterprise Library - June 2005-Application Blocks for .NET-Enterprise Library Solution

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.
 点击“Common”项目的“属性”
Rt Clk on the “Common” project and go to “Properties”

4.
选择“配置属性”下的“生成”项
In the “Configuration Properties” go to the “Build” option.

5.
在“条件编译常数”中去掉除 DEBUG;TRACE 外的其他项
In the Conditional Build section of the property grid, remove everything except “DEBUG;TRACE”

6.
重新编译 Microsoft.Practices.EnterpriseLibrary.Common 项目
关闭所有项目
Close everything and recompile.
7.运行开始-程序- Microsoft patterns & practices-Enterprise Library - June 2005-Copy Assemblies to bin Folder

    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.

8.在使用企业库的项目文件中重新添加引用后编译项目。

Now...just to be sure....de-reference your existing references to the entlib and add references again.....and woala.....you are done.

其他解决方案:
1、去掉这些代码。(这会是一个痛苦的经历,代码割舍不清呀)
2、给IUSR 帐户访问注册表的权限(安全问题呀!)


你可能感兴趣的:(异常详细信息: System.Security.SecurityException: 不允许所请求的注册表访问权)