I used petshop to change a website, Program When an error occurs, the error "the registry cannot be accessed" is fixed,
------------------------------------------------------------------------
{
EventLog m_enentlog = NULL;
Row 14: If (! ( EventLog. sourceexists (error_log_source )))
Row 15 :{
Row 16: EventLog. createeventsource (error_log_source, "application ");
------------------------------------------------------------------------
The original error in petshop was to be written to the operating system log, in erro. CS: Public Class Error
{ // For example, the name of my application is comeday.
Const String Error_log_source = " Comeday " ;
Public Static Void Log ( String Message)
{
EventLog m_enentlog = Null ;
If ( ! (Eventlog. sourceexists (error_log_source )))
{
EventLog. createeventsource (error_log_source,"Application");
}
If (M_enentlog = Null )
{
M_enentlog=NewEventLog ("Application");
M_enentlog.source=Error_log_source;
}
M_enentlog.writeentry (message, system. Diagnostics. eventlogentrytype. Error );
}
}
solution:
in the registry
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Eventlog \ Application
, add the following item: " comeday " (your application name, my name is comeday.