Tried everything - "Requested registry access is not allowed"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts

  • Annadurai.S
    Guest replied
    Re: Tried everything - "Reques ted registry access is not allowed"


    Hi,
    try this way you may resolve that error

    just goto control panel->Administarti ve tools->eventLog
    delete all the application/systems events

    and if you have used in your application like
    Eventlog(Servic eConfig)

    in business logic

    BeginTransactio n()
    {


    }
    rollback transaction()
    {

    }
    committransctio n()
    {

    }
    endtransaction( )
    {


    }
    you should have to comment like



    BeginTransactio n()
    {

    /* some set of codes... */
    }
    rollback transaction()
    {

    /* some set of codes... */

    }
    committransctio n()
    {
    /* some set of codes... */

    }
    endtransaction( )
    {
    /* some set of codes... */

    }

    if your os is XP means it works fine without commenting now you are
    using windows 2000 server so try my way

    Thanks
    Annadurai.S



    --
    Annadurai.S
    ------------------------------------------------------------------------
    Posted via http://www.mcse.ms
    ------------------------------------------------------------------------
    View this thread: http://www.mcse.ms/message1204708.html

    Leave a comment:


  • Dan Rogers
    Guest replied
    RE: Tried everything - "Reques ted registry access is not allowed"

    A better way to do this is to put the event log writing code in a fully
    trusted assembly, and attribute it to With
    AllowPartiallyT rustedCallersAt tribute.

    --------------------
    Thread-Topic: Tried everything - "Requested registry access is not allowed"
    thread-index: AcTDHRlsTLtD0O4 QQiy1g2fAjbWA5g ==
    X-WBNR-Posting-Host: 164.164.12.225
    From: "=?Utf-8?B?TFA=?=" <LP@discussions .microsoft.com>
    Subject: Tried everything - "Requested registry access is not allowed"
    Date: Fri, 5 Nov 2004 01:52:02 -0800
    Lines: 43
    Message-ID: <07DB319A-1A60-41FF-A1F7-419C192F6B1B@mi crosoft.com>
    MIME-Version: 1.0
    Content-Type: text/plain;
    charset="Utf-8"
    Content-Transfer-Encoding: 7bit
    X-Newsreader: Microsoft CDO for Windows 2000
    Content-Class: urn:content-classes:message
    Importance: normal
    Priority: normal
    X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
    Newsgroups: microsoft.publi c.dotnet.framew ork.webservices
    NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.1.29
    Path: cpmsftngxa10.ph x.gbl!TK2MSFTNG XA03.phx.gbl
    Xref: cpmsftngxa10.ph x.gbl
    microsoft.publi c.dotnet.framew ork.webservices :7257
    X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.webservices

    Hi,

    My webservice is currently deployed on WIndows 2000 server and runs pretty
    fine. I am trying to run my webservice on a Windows 2003 server. My
    webservice tries to write to a eventlog. The code is as follows:

    System.Diagnost ics.EventLog Log = new System.Diagnost ics.EventLog(
    EventLogName );
    Log.Source = EventLogName;
    Log.WriteEntry( "PCHistory Service Application started up successfully.",
    System.Diagnost ics.EventLogEnt ryType.Informat ion );

    I am getting the following error.

    System.Security .SecurityExcept ion: Requested registry access is not allowed.
    at Microsoft.Win32 .RegistryKey.Op enSubKey(String name, Boolean writable)
    at System.Diagnost ics.EventLog.Cr eateEventSource (String source, String
    logName, String machineName, Boolean useMutex)
    at System.Diagnost ics.EventLog.Wr iteEntry(String message, EventLogEntryTy pe
    type, Int32 eventID, Int16 category, Byte[] rawData)
    at System.Diagnost ics.EventLog.Wr iteEntry(String message, EventLogEntryTy pe
    type, Int32 eventID, Int16 category)
    at System.Diagnost ics.EventLog.Wr iteEntry(String message, EventLogEntryTy pe
    type, Int32 eventID)
    at System.Diagnost ics.EventLog.Wr iteEntry(String message, EventLogEntryTy pe
    type)
    at PCHistory.PCHis toryService.Log (String Message, EventLogEntryTy pe type)
    at PCHistory.PCHis toryService.Log Info(String Message, Object[] args)
    at PCHistory.PCHis toryService..ct or()

    I tried the following:
    1. Giving full rights to ASPNET account on
    HKLM\System\Cur rentControlSet\ Services\Eventl og
    2.Giving SetValue and CreateSubkey rights to ASPNET account on the same.
    3.Changing machine .config process model attribute of USerName to SYSTEM.
    4. Creating the Source manually in the registry.

    Nothing worked.

    If u have solution please reply ASAP.

    Thanks
    LP

    Leave a comment:


  • LP
    Guest replied
    Re: Tried everything - &quot;Reques ted registry access is not allowed&quot;

    Hi,

    I figured out the problem. It was improper access rights (in the event log)
    to the account the webservice was running under. When I started looking into
    the IIS, I found that the Default application pool ran under the identity of
    "Network Service" which is the least priveleged account. Hence it has minimal
    access i.e security associated to it is high. This did not allow creating a
    new event log and writing into it. I have several options which we can decide
    to utilise:

    1.Change IIS Isolation Mode Setting:
    Right click on "WebSites" under IIS 6.0. Then Click to open the "Service"
    tab. Check the chekcbox labelled "Run WWW service in IIS 5.0 isolation
    mode.". Click OK and then restart IIS. This will allow your app to run in IIS
    5.0 mode.
    2. Change IIS Application Pool Setting:
    Click on Application Pools under IIS. Right click on the "DefaultAppPool ".
    Go to the "Identity" tab, and change the Predefined value to "LocalSyste m".
    CLick Yes on the warning and Click OK.
    3. Change Registry setting:
    Go to "HKEY_LOCAL_MAC HINE\System\Cur rentCOntrolSet\ EventLog". RIght click
    on "eventLog" and choose "permission s". Click on the "Advanced" tab below.
    This will open the "Advanced Security settings for event log" dialog box.
    Click on the "Add" button in the "Permission s" tab. This will open the
    "Select USer or Group" dialog box. Click "Advanced" button and find the
    "NETWORK SERVICE" account. Select this account and click on OK. Confirm the
    account by clicking OK on the "Select User or Group" dialog box. This will
    open the "Permission entry for event log" dialog box. Check on the "Set
    Value" and "Create SUbkey" items and click on OK. Now confirm on all the
    underlying dialog boxes by clicking on OK.
    I feel the last one is the best solution.

    THanks
    LP


    "Scott M." wrote:
    [color=blue]
    > Just for kicks, change the:
    >
    > HKLM\System\Cur rentControlSet\ Services\Eventl og
    >
    > key so that "Everyone" has full access and try it then.
    >
    > "LP" <LP@discussions .microsoft.com> wrote in message
    > news:07DB319A-1A60-41FF-A1F7-419C192F6B1B@mi crosoft.com...[color=green]
    > > Hi,
    > >
    > > My webservice is currently deployed on WIndows 2000 server and runs pretty
    > > fine. I am trying to run my webservice on a Windows 2003 server. My
    > > webservice tries to write to a eventlog. The code is as follows:
    > >
    > > System.Diagnost ics.EventLog Log = new System.Diagnost ics.EventLog(
    > > EventLogName );
    > > Log.Source = EventLogName;
    > > Log.WriteEntry( "PCHistory Service Application started up successfully.",
    > > System.Diagnost ics.EventLogEnt ryType.Informat ion );
    > >
    > > I am getting the following error.
    > >
    > > System.Security .SecurityExcept ion: Requested registry access is not
    > > allowed.
    > > at Microsoft.Win32 .RegistryKey.Op enSubKey(String name, Boolean writable)
    > > at System.Diagnost ics.EventLog.Cr eateEventSource (String source, String
    > > logName, String machineName, Boolean useMutex)
    > > at System.Diagnost ics.EventLog.Wr iteEntry(String message,
    > > EventLogEntryTy pe
    > > type, Int32 eventID, Int16 category, Byte[] rawData)
    > > at System.Diagnost ics.EventLog.Wr iteEntry(String message,
    > > EventLogEntryTy pe
    > > type, Int32 eventID, Int16 category)
    > > at System.Diagnost ics.EventLog.Wr iteEntry(String message,
    > > EventLogEntryTy pe
    > > type, Int32 eventID)
    > > at System.Diagnost ics.EventLog.Wr iteEntry(String message,
    > > EventLogEntryTy pe
    > > type)
    > > at PCHistory.PCHis toryService.Log (String Message, EventLogEntryTy pe type)
    > > at PCHistory.PCHis toryService.Log Info(String Message, Object[] args)
    > > at PCHistory.PCHis toryService..ct or()
    > >
    > > I tried the following:
    > > 1. Giving full rights to ASPNET account on
    > > HKLM\System\Cur rentControlSet\ Services\Eventl og
    > > 2.Giving SetValue and CreateSubkey rights to ASPNET account on the same.
    > > 3.Changing machine .config process model attribute of USerName to SYSTEM.
    > > 4. Creating the Source manually in the registry.
    > >
    > > Nothing worked.
    > >
    > > If u have solution please reply ASAP.
    > >
    > > Thanks
    > > LP[/color]
    >
    >
    >[/color]

    Leave a comment:


  • Scott M.
    Guest replied
    Re: Tried everything - &quot;Reques ted registry access is not allowed&quot;

    Just for kicks, change the:

    HKLM\System\Cur rentControlSet\ Services\Eventl og

    key so that "Everyone" has full access and try it then.

    "LP" <LP@discussions .microsoft.com> wrote in message
    news:07DB319A-1A60-41FF-A1F7-419C192F6B1B@mi crosoft.com...[color=blue]
    > Hi,
    >
    > My webservice is currently deployed on WIndows 2000 server and runs pretty
    > fine. I am trying to run my webservice on a Windows 2003 server. My
    > webservice tries to write to a eventlog. The code is as follows:
    >
    > System.Diagnost ics.EventLog Log = new System.Diagnost ics.EventLog(
    > EventLogName );
    > Log.Source = EventLogName;
    > Log.WriteEntry( "PCHistory Service Application started up successfully.",
    > System.Diagnost ics.EventLogEnt ryType.Informat ion );
    >
    > I am getting the following error.
    >
    > System.Security .SecurityExcept ion: Requested registry access is not
    > allowed.
    > at Microsoft.Win32 .RegistryKey.Op enSubKey(String name, Boolean writable)
    > at System.Diagnost ics.EventLog.Cr eateEventSource (String source, String
    > logName, String machineName, Boolean useMutex)
    > at System.Diagnost ics.EventLog.Wr iteEntry(String message,
    > EventLogEntryTy pe
    > type, Int32 eventID, Int16 category, Byte[] rawData)
    > at System.Diagnost ics.EventLog.Wr iteEntry(String message,
    > EventLogEntryTy pe
    > type, Int32 eventID, Int16 category)
    > at System.Diagnost ics.EventLog.Wr iteEntry(String message,
    > EventLogEntryTy pe
    > type, Int32 eventID)
    > at System.Diagnost ics.EventLog.Wr iteEntry(String message,
    > EventLogEntryTy pe
    > type)
    > at PCHistory.PCHis toryService.Log (String Message, EventLogEntryTy pe type)
    > at PCHistory.PCHis toryService.Log Info(String Message, Object[] args)
    > at PCHistory.PCHis toryService..ct or()
    >
    > I tried the following:
    > 1. Giving full rights to ASPNET account on
    > HKLM\System\Cur rentControlSet\ Services\Eventl og
    > 2.Giving SetValue and CreateSubkey rights to ASPNET account on the same.
    > 3.Changing machine .config process model attribute of USerName to SYSTEM.
    > 4. Creating the Source manually in the registry.
    >
    > Nothing worked.
    >
    > If u have solution please reply ASAP.
    >
    > Thanks
    > LP[/color]


    Leave a comment:


  • LP
    Guest started a topic Tried everything - "Requested registry access is not allowed"

    Tried everything - "Requested registry access is not allowed"

    Hi,

    My webservice is currently deployed on WIndows 2000 server and runs pretty
    fine. I am trying to run my webservice on a Windows 2003 server. My
    webservice tries to write to a eventlog. The code is as follows:

    System.Diagnost ics.EventLog Log = new System.Diagnost ics.EventLog(
    EventLogName );
    Log.Source = EventLogName;
    Log.WriteEntry( "PCHistory Service Application started up successfully.",
    System.Diagnost ics.EventLogEnt ryType.Informat ion );

    I am getting the following error.

    System.Security .SecurityExcept ion: Requested registry access is not allowed.
    at Microsoft.Win32 .RegistryKey.Op enSubKey(String name, Boolean writable)
    at System.Diagnost ics.EventLog.Cr eateEventSource (String source, String
    logName, String machineName, Boolean useMutex)
    at System.Diagnost ics.EventLog.Wr iteEntry(String message, EventLogEntryTy pe
    type, Int32 eventID, Int16 category, Byte[] rawData)
    at System.Diagnost ics.EventLog.Wr iteEntry(String message, EventLogEntryTy pe
    type, Int32 eventID, Int16 category)
    at System.Diagnost ics.EventLog.Wr iteEntry(String message, EventLogEntryTy pe
    type, Int32 eventID)
    at System.Diagnost ics.EventLog.Wr iteEntry(String message, EventLogEntryTy pe
    type)
    at PCHistory.PCHis toryService.Log (String Message, EventLogEntryTy pe type)
    at PCHistory.PCHis toryService.Log Info(String Message, Object[] args)
    at PCHistory.PCHis toryService..ct or()

    I tried the following:
    1. Giving full rights to ASPNET account on
    HKLM\System\Cur rentControlSet\ Services\Eventl og
    2.Giving SetValue and CreateSubkey rights to ASPNET account on the same.
    3.Changing machine .config process model attribute of USerName to SYSTEM.
    4. Creating the Source manually in the registry.

    Nothing worked.

    If u have solution please reply ASAP.

    Thanks
    LP
Working...