蝈蝈俊.net

-- 用随笔来记录自己的技术感触
随笔 - 655, 评论 - 4839, 引用 - 276

导航

关于

这里是我的技术Blog,下一代CSDN社区Blog在 http://blog.csdn.net/ghj1976/

标签

每月存档

最新留言

  • re:WPF/Silverlight 控件的几幅继承关系图
    <p class="MsoNormal" style="text-align: center; line-height: 20pt; margin: 0cm 0cm...
    by oaoffices(注册) on 2010/2/7 18:38:37
  • tWTqXHvjmOmv
    XZ5W2T &lt;a href=&quot;http://zecclkdejwou.com/&quot;&gt;zecclkdejwou&lt;/a&am...
    by uwwkhptujtw(匿名) on 2010/2/7 11:26:16
  • Re
    Many times we wanted to order significant example thesis close to this topic in the &lt;a href=&...
    by Ellieru(匿名) on 2010/2/6 10:25:37
  • Rrwvthsw
    Very Good Site &lt;a href=&quot; http://www.newsland.it/nr/article/it-alt.faq/4163.html &...
    by Rrwvthsw(匿名) on 2010/2/6 5:51:43
  • Edozadcx
    Good crew it's cool :) &lt;a href=&quot; http://www.newsland.it/nr/article/it-alt.faq/4163.h...
    by Edozadcx(匿名) on 2010/2/6 3:56:25
  • Ptryjfhi
    i'm fine good work &lt;a href=&quot; http://www.newsland.it/nr/article/it-alt.faq/4143.html ...
    by Ptryjfhi(匿名) on 2010/2/6 2:52:34
  • samuel
    5l05ro http://www.cRk2bdPqQls602mIa4bgo.com
    by samuel(匿名) on 2010/2/5 4:00:27
  • samuel
    5l05ro http://www.cRk2bdPqQls602mIa4bgo.com
    by samuel(匿名) on 2010/2/5 4:00:25
  • qCSFwFqaMVQizlCas
    2dnR2u &lt;a href=&quot;http://geunkaxpmhqt.com/&quot;&gt;geunkaxpmhqt&lt;/a&am...
    by spahxbypafn(匿名) on 2010/2/5 1:47:48
  • Re
    Very oft the &lt;a href=&quot;http://quality-papers.com/topics/comparison_essay&quot;&am...
    by Gwen18uV(匿名) on 2010/2/4 16:16:33
  • samuel
    SnU3S6 http://www.cRk2bdPqQls602mIa4bgo.com
    by samuel(匿名) on 2010/2/4 15:37:58
  • Koxtggnh
    It's serious &lt;a href=&quot; http://www.newsland.it/nr/article/it-alt.faq/3298.html &q...
    by Koxtggnh(匿名) on 2010/2/4 6:09:20
  • SrehssllMZjp
    XefKdm &lt;a href=&quot;http://onztwqzldpty.com/&quot;&gt;onztwqzldpty&lt;/a&am...
    by fsfirjqclpn(匿名) on 2010/2/4 0:43:23
  • OLDLqAKsuD
    BnPVvu &lt;a href=&quot;http://jzyknfzplvon.com/&quot;&gt;jzyknfzplvon&lt;/a&am...
    by ofudghioo(匿名) on 2010/2/4 0:07:18
  • Hwbjmqub
    Punk not dead &lt;a href=&quot; http://www.newsland.it/nr/article/it-alt.faq/3238.html &...
    by Hwbjmqub(匿名) on 2010/2/3 14:14:20
  • Re
    From time to time different students have assignments to compose the &lt;a href=&quot;http:/...
    by Rebeccamp28(匿名) on 2010/2/3 11:04:43
  • emRTIwMZOMDFfCg
    nQf5M6 &lt;a href=&quot;http://eaykuvqnrful.com/&quot;&gt;eaykuvqnrful&lt;/a&am...
    by pnxjuwq(匿名) on 2010/2/2 23:36:36
  • jPRCuLgHySwb
    qc0qb5 &lt;a href=&quot;http://ciktzfijfsfj.com/&quot;&gt;ciktzfijfsfj&lt;/a&am...
    by yuplvewx(匿名) on 2010/2/2 19:05:07
  • re:IP to Integer
    IPV6呢?
    by howie(匿名) on 2010/2/2 10:34:10
  • IcqpxCPAVoKn
    Ff4AZo &lt;a href=&quot;http://bovwngagtlua.com/&quot;&gt;bovwngagtlua&lt;/a&am...
    by mbnbusiuh(匿名) on 2010/2/1 18:40:41
  • tJZDsNznVk
    scXyAq &lt;a href=&quot;http://pqtnkiwdacoa.com/&quot;&gt;pqtnkiwdacoa&lt;/a&am...
    by lwummgsncve(匿名) on 2010/2/1 3:53:51
  • Okurlpzt
    i'm fine good work &lt;a href=&quot; http://littlelolitasmodels.vox.com/ &quot;&gt;p...
    by Okurlpzt(匿名) on 2010/1/31 19:30:08
  • Sgoonhvn
    Excellent work, Nice Design &lt;a href=&quot; http://littlelolitasmodels.vox.com/ &quot;...
    by Sgoonhvn(匿名) on 2010/1/31 18:29:47
  • Zloozuuj
    Punk not dead &lt;a href=&quot; http://lolitatoplist.vox.com/ &quot;&gt;lolita mpeg...
    by Zloozuuj(匿名) on 2010/1/31 17:52:04
  • Jmqskdlf
    I love this site &lt;a href=&quot; http://younglolitasbbs.vox.com/ &quot;&gt;preetee...
    by Jmqskdlf(匿名) on 2010/1/31 15:09:12
  • Tmmhaxbr
    Wonderfull great site &lt;a href=&quot; http://lolitabbs969.vox.com &quot;&gt;lolita...
    by Tmmhaxbr(匿名) on 2010/1/31 14:31:36
  • Asnejtjx
    real beauty page &lt;a href=&quot; http://underagelolitas.vox.com/ &quot;&gt;top 50 ...
    by Asnejtjx(匿名) on 2010/1/31 12:51:18
  • Tibtihsu
    &lt;a href=&quot; http://lolitamodels.vox.com/ &quot;&gt;real young lolitas&lt;...
    by Tibtihsu(匿名) on 2010/1/31 7:50:15
  • Jlcdzoem
    Very Good Site &lt;a href=&quot; http://lolitamodels.vox.com/ &quot;&gt;kds pedo lol...
    by Jlcdzoem(匿名) on 2010/1/31 6:47:06
  • Eqczveev
    i'm fine good work &lt;a href=&quot; http://mipagina.univision.com/preteenlolitabbs/ &qu...
    by Eqczveev(匿名) on 2010/1/31 6:08:16
  • Ndhvewjd
    Very interesting tale &lt;a href=&quot; http://mipagina.univision.com/preteenlolitabbs/ &...
    by Ndhvewjd(匿名) on 2010/1/31 5:06:34
  • Jktojpnv
    &lt;a href=&quot; http://mipagina.univision.com/preteenlolitamodels/ &quot;&gt;goth...
    by Jktojpnv(匿名) on 2010/1/31 3:27:26
  • Lftiemmn
    Very interesting tale &lt;a href=&quot; http://mipagina.univision.com/preteenyounglolitas/ &...
    by Lftiemmn(匿名) on 2010/1/31 2:51:02
  • ITYAtUVjqijsAcZ
    4SnRK4 &lt;a href=&quot;http://lbmuqlnscvjk.com/&quot;&gt;lbmuqlnscvjk&lt;/a&am...
    by pqoqxfvrbcb(匿名) on 2010/1/30 19:25:06
  • bjhbHxudMahxGCkiue
    3mRPzg &lt;a href=&quot;http://rzitclgaemis.com/&quot;&gt;rzitclgaemis&lt;/a&am...
    by quglkot(匿名) on 2010/1/30 19:20:51

广告

 

我们在WEB站点使用企业库的时候,有时候会有如下的异常产生:

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

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

堆栈跟踪:

[SecurityException: 不允许所请求的注册表访问权。]
   Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +473
   System.Diagnostics.EventLog.CreateEventSource(String source, String logName, String machineName, Boolean useMutex) +443
   System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) +347
   System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category) +21
........  

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)

        造成这个的原因是企业库的公共项目中:Instrumentation 目录下有操作日志、性能的代码。而这些代码需要一定的权限才可以执行。

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

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

具体步骤请参看:
http://dotnetjunkies.com/WebLog/sskokku/archive/2005/03/25/61376.aspx

附图:

如何修改企业库公共项目的生成配置 

打印 | 张贴于 2005-07-26 17:03:00 | Tag:.net 编程心得  技术随笔

留言反馈

#re: 使用企业库在某些站点会报试图执行安全策略不允许的操作异常的解决方法。 编辑
一些跟日志记录有关的权限请看:

尝试创建自定义事件日志时,将会收到“Requested registry access is not allowed(不允许所请求的注册表访问权)”错误消息

http://support.microsoft.com/kb/842795/zh-cn
2008-09-11 13:47:03 | [匿名:ghj1976]
# [EntLibFAQ]“不允许所请求的注册表访问权”的解释[0508Update] 编辑
[EntLibFAQ]
2007-12-17 11:07:00 | [匿名:csdnexpert]
#回复: 使用企业库在某些站点会报试图执行安全策略不允许的操作异常的解决方法。 编辑
good 正在困扰中
2007-02-03 23:03:00 | [匿名:net]
#关于“不允许所请求的注册表访问权”问题的总结.txt 编辑
“/OracleWeb”应用程序中的服务器错误。
2006-12-23 15:59:00 | [匿名:siyuan926]
#上下五千年 编辑
“上下五千年” 古玩古董交流交易的专业网站,愿与广大收藏爱好者共同切磋交流。
网址:www.wuqiannian.cn

E-mail:web@wuqiannian.cn
2006-07-14 10:25:00 | [匿名:张先生]
#re: 使用企业库在某些站点会报试图执行安全策略不允许的操作异常的解决方法。 编辑
“IIS虚拟目录的匿名访问选择框点掉再选中”指的是:
首先,不让虚拟目录启用匿名访问,这样在本机管理员身份下访问你的web应用,因为你当前的身份应该拥有对注册表的权限,所以肯定能做EntLib要做的事情。然后,再让虚拟目录启用匿名访问,再次访问Web应用,一切依旧ok,不再报告“System.Security.SecurityException: 不允许所请求的注册表访问权。”了。
2006-04-30 18:55:00 | [匿名:zhengyun]
#re: 使用企业库在某些站点会报试图执行安全策略不允许的操作异常的解决方法。 编辑
我也遇到wangchao 的问题,请问怎么解决啊
2005-12-26 17:10:00 | [匿名:shoutor]
#re: 使用企业库在某些站点会报试图执行安全策略不允许的操作异常的解决方法。 编辑
求命啊,跟楼上遇到的问题一样的!调试发现在Microsoft.Practices.EnterpriseLibrary.Caching.Instrumentation.CachingServiceItemTurnoverEvent这个类的 private void SetTotal(long totalItems)
{
totalEntriesInstances.RawValue(totalItems);
}这段代码出错!totalEntriesInstances是空的!我的email:hjf1223@163.com
2005-08-27 16:07:00 | [匿名:§猪阿不猪§]
#re: 使用企业库在某些站点会报试图执行安全策略不允许的操作异常的解决方法。 编辑
这个办法能解决权限问题,但是我发现又有新的问题出现了就是CacheManager mang=CacheFactory.GetCacheManager()出错了,错误是未将对象引用到实例,请问那为高手知道解决的办法.小弟不胜感激.我的邮件是woshichaoren@126.com.有了解的高手就发发好心,帮我一把吧.谢谢.
2005-07-27 16:32:00 | [匿名:wangchao]
#re: 使用企业库在某些站点会报试图执行安全策略不允许的操作异常的解决方法。 编辑
默认的 Conditional Compilation Constants 设置是如下几个:

DEBUG;TRACE;USEWMI;USEEVENTLOG;USEPERFORMANCECOUNTER
2005-07-26 22:39:00 | [匿名:ghj1976]
#re: 使用企业库在某些站点会报试图执行安全策略不允许的操作异常的解决方法。 编辑
为了避免联接失效,Copy 一下具体步骤:

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.

2005-07-26 17:06:00 | [匿名:ghj1976]
对不起,目前本随笔不允许发表新评论.

Powered by: Joycode.MVC引擎 0.5.2.0