Menu

Problem Changing Registry

Ian B
2005-01-28
2013-03-07
  • Ian B

    Ian B - 2005-01-28

    Hi

    I am using the AtomsFramework on a webserver but get a "security exception" when initalising the persistence broker. I think that it is trying to set a registry key in CPersistenceBroker.InitPerformanceCounters() but the registry is restricted Is there any way to avoid changing the registry.

    I have included the error details

    Many Thanks
    Ian

    Exception Details
    ----------------

    System.Security.SecurityException: Requested registry access is not allowed.

    Stack Trace
    ------------

    [SecurityException: Requested registry access is not allowed.]
       Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +473
       System.Diagnostics.PerformanceCounterLib.CreateRegistryEntry(String machineName, String categoryName, CounterCreationDataCollection creationData, Boolean& iniRegistered) +184
       System.Diagnostics.PerformanceCounterLib.RegisterCategory(String machineName, String categoryName, String categoryHelp, CounterCreationDataCollection creationData) +43
       System.Diagnostics.PerformanceCounterCategory.Create(String categoryName, String categoryHelp, CounterCreationDataCollection counterData, String machineName, String localizedIniFilePath) +925
       System.Diagnostics.PerformanceCounterCategory.Create(String categoryName, String categoryHelp, CounterCreationDataCollection counterData) +17
       AToMSFramework.CPersistenceBroker.InitPerformanceCounters() +856
       AToMSFramework.modPersistenceBrokerSingleton.getOrSetPBInstance(CPersistenceBroker& pb) +138
       AToMSFramework.CPersistenceBroker.init(String xmlfile) +26
       payments.deposit.Page_Load(Object sender, EventArgs e) +62
       System.Web.UI.Control.OnLoad(EventArgs e) +67
       System.Web.UI.Control.LoadRecursive() +35
       System.Web.UI.Page.ProcessRequestMain() +2112
       System.Web.UI.Page.ProcessRequest() +218
       System.Web.UI.Page.ProcessRequest(HttpContext context) +18
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +179
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87

     
    • Richard Banks

      Richard Banks - 2005-01-29

      Hi Ian,

      Others have reported this problem before.  To fix it, I've added errors handlers around all the performance counter code to catch the errors and continue on without a problem.

      Unfortunately, you will need to get the latest source code from CVS for this fix as I haven't rolled it up into a new release yet.

      If you don't have CVS access or can't download the code let me know and I'll send you a zip file.

       
    • Ian B

      Ian B - 2005-02-01

      Hi Richard,

      That worked like a dream.

      We are using the Framework in this project as a test case to see if we can roll it out to our other projects. It's all looking good so far.

      We use Nunit extensively with all our projects. When I get some time on my hands, I will see if I can offer any help on this side of things. In the meantime keep up the good work

      Many Thanks
      Ian

       
    • drventure

      drventure - 2005-02-06

      I've run into the same issue. The problem seems to be an assembly rights issue (in my case, I'm testing things with the whole framework included in my main project)

      Error trapping the perfcounters will work, but wouldn't it be better to add a config to the DATABASE element of the Mapping file to allow you to turn on/off counter support?

       
      • Richard Banks

        Richard Banks - 2005-02-06

        The problem with adding a flag to the XML is that it's possible to have multiple databases.  If one database has the flag on and one has it off which do I use?

        It also means an extra thing to check for when doing configurations, and I don't really like the solution.  I would much rather it be a setting in the persistence broker that you can turn on/off via a property at run time.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.