使用enterprise library部属中出现的问题

版权声明: https://blog.csdn.net/ycl111/article/details/555960

使用enterprise library部属中出现的问题
在公司的最近的一个项目中使用了enterprise library做开发,结果在部属时出现 异常详细信息: System.Security.SecurityException: 不允许所请求的注册表访问权。
google的结果

使用EnterpriseLibrary的应用程序在某些机器上使用,会出现异常错误,提示信息如下:

安全性异常
说明:应用程序试图执行安全策略不允许的操作。要授予此应用程序所需的权限,请与系统管理员联系,或在配置文件中更改该应用程序的信任级别。
异常详细信息: System.Security.SecurityException: 不允许所请求的注册表访问权。

在Enterprise Library的FAQs中可以找到答案,有三种解决办法:
1. 运行安装Enterprise Library时安装的“InstallServices.bat”批处理文件。
2. 运行.NET的installutil程序设置(上面的脚本也是使用installutil命令)。
3. 去掉Common工程中USEWMI、USEEVENTLOG和USEPERFORMANCECOUNTER三个编译参数,重新编译EntLib。


使用方法3,结果ok。
===============================================================================
也可以使用
@SET InstallUtilPath=%windir%/Microsoft.NET/Framework/v1.1.4322/InstallUtil.exe
@ECHO.
@ECHO -----------------------------------------------------------------
@ECHO Installing Services for the Caching Application Block
@ECHO -----------------------------------------------------------------
@ECHO.
if Exist Microsoft.Practices.EnterpriseLibrary.Caching.dll @%InstallUtilPath% Microsoft.Practices.EnterpriseLibrary.Caching.dll
@ECHO.
@ECHO -----------------------------------------------------------------
@ECHO Installing Services for the ConfigurationApplication Block
@ECHO -----------------------------------------------------------------
@ECHO.
if Exist Microsoft.Practices.EnterpriseLibrary.Configuration.dll @%InstallUtilPath% Microsoft.Practices.EnterpriseLibrary.Configuration.dll
@ECHO.
@ECHO -----------------------------------------------------------------
@ECHO Installing Services for the Cryptography Application Block
@ECHO -----------------------------------------------------------------
@ECHO.
if Exist Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.dll @%InstallUtilPath% Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.dll
@ECHO.
@ECHO -----------------------------------------------------------------
@ECHO Installing Services for the Data Access Application Block
@ECHO -----------------------------------------------------------------
@ECHO.
if Exist Microsoft.Practices.EnterpriseLibrary.Data.dll @%InstallUtilPath% Microsoft.Practices.EnterpriseLibrary.Data.dll
@ECHO.
@ECHO -----------------------------------------------------------------------
@ECHO Installing Services for the Exception Handling Application Block
@ECHO -----------------------------------------------------------------------
@ECHO.
if Exist Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll @%InstallUtilPath% Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
@ECHO.
@ECHO ---------------------------------------------------------------------------------
@ECHO Installing Services for the Logging and Instrumentation Application Block
@ECHO ---------------------------------------------------------------------------------
@ECHO.
if Exist Microsoft.Practices.EnterpriseLibrary.Logging.dll @%InstallUtilPath% Microsoft.Practices.EnterpriseLibrary.Logging.dll
@ECHO.
@ECHO -----------------------------------------------------------------
@ECHO Installing Services for the Security Application Block
@ECHO -----------------------------------------------------------------
@ECHO.
if Exist Microsoft.Practices.EnterpriseLibrary.Security.dll @%InstallUtilPath% Microsoft.Practices.EnterpriseLibrary.Security.dll
@ECHO.
@ECHO ----------------------------------------
@ECHO InstallServices.bat Completed
@ECHO ----------------------------------------
@ECHO.
@PAUSE
保存为aa.bat放到应用程序目录中,然后运行
或修改注册表
增加
Enterprise Library Data Service
Enterprise Library Instrumentation
Enterprise Library Logging
EventMessageFile
C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/EventLogMessages.dll
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页