Can anyone help me on this error "The type initializer for 'System.Transactions.Diagnostics.DiagnosticTrace' threw an exception."?
I encountered this error when I added the .exe file of my batch program in Task Scheduler.
Thank you.
System.TypeInitializationException was unhandled
Message=The type initializer for 'System.Transactions.Diagnostics.DiagnosticTrace' threw an exception.
Source=System.Transactions
TypeName=System.Transactions.Diagnostics.DiagnosticTrace
StackTrace:
at System.Transactions.Transaction.get_Current()
at System.Data.Common.ADP.IsSysTxEqualSysEsTransaction()
at System.Data.Common.ADP.NeedManualEnlistment()
at System.Data.Odbc.OdbcConnection.Open()
at Branches.DAL.fncGetBranches()
at Branches.BLL.UpdateBranches(BranchBO bo)
at Branches.Program.Main()
InnerException: System.Configuration.ConfigurationErrorsException
Message=Configuration system failed to initialize
Source=System.Configuration
BareMessage=Configuration system failed to initialize
Line=0
StackTrace:
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
at System.Diagnostics.DiagnosticsConfiguration.Initialize()
at System.Diagnostics.DiagnosticsConfiguration.get_Sources()
at System.Diagnostics.TraceSource.Initialize()
at System.Transactions.Diagnostics.DiagnosticTrace..cctor()
InnerException: System.Configuration.ConfigurationErrorsException
Message=An error occurred loading a configuration file: Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config' is denied. (C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config)
Source=System.Configuration
BareMessage=An error occurred loading a configuration file: Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config' is denied.
Filename=C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
Line=0
StackTrace:
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
InnerException: System.UnauthorizedAccessException
Message=Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config' is denied.
Source=mscorlib
StackTrace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.Configuration.Internal.InternalConfigHost.StaticOpenStreamForRead(String streamName)
at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName, Boolean assertPermissions)
at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName)
at System.Configuration.ClientConfigurationHost.OpenStreamForRead(String streamName)
at System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
InnerException:
quickmelt
Member
83 Points
60 Posts
batch run error
Mar 31, 2012 06:28 AM|LINK
Hi,
Can anyone help me on this error "The type initializer for 'System.Transactions.Diagnostics.DiagnosticTrace' threw an exception."?
I encountered this error when I added the .exe file of my batch program in Task Scheduler.
Thank you.
System.TypeInitializationException was unhandled Message=The type initializer for 'System.Transactions.Diagnostics.DiagnosticTrace' threw an exception. Source=System.Transactions TypeName=System.Transactions.Diagnostics.DiagnosticTrace StackTrace: at System.Transactions.Transaction.get_Current() at System.Data.Common.ADP.IsSysTxEqualSysEsTransaction() at System.Data.Common.ADP.NeedManualEnlistment() at System.Data.Odbc.OdbcConnection.Open() at Branches.DAL.fncGetBranches() at Branches.BLL.UpdateBranches(BranchBO bo) at Branches.Program.Main() InnerException: System.Configuration.ConfigurationErrorsException Message=Configuration system failed to initialize Source=System.Configuration BareMessage=Configuration system failed to initialize Line=0 StackTrace: at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey) at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName) at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName) at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection() at System.Diagnostics.DiagnosticsConfiguration.Initialize() at System.Diagnostics.DiagnosticsConfiguration.get_Sources() at System.Diagnostics.TraceSource.Initialize() at System.Transactions.Diagnostics.DiagnosticTrace..cctor() InnerException: System.Configuration.ConfigurationErrorsException Message=An error occurred loading a configuration file: Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config' is denied. (C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config) Source=System.Configuration BareMessage=An error occurred loading a configuration file: Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config' is denied. Filename=C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config Line=0 StackTrace: at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal) at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors) at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors() at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey) InnerException: System.UnauthorizedAccessException Message=Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config' is denied. Source=mscorlib StackTrace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at System.Configuration.Internal.InternalConfigHost.StaticOpenStreamForRead(String streamName) at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName, Boolean assertPermissions) at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName) at System.Configuration.ClientConfigurationHost.OpenStreamForRead(String streamName) at System.Configuration.BaseConfigurationRecord.InitConfigFromFile() InnerException:ignatandrei
All-Star
137716 Points
22159 Posts
Moderator
MVP
Re: batch run error
Mar 31, 2012 09:24 PM|LINK
check the user of task scheduler item if have rights on
quickmelt
Member
83 Points
60 Posts
Re: batch run error
Apr 02, 2012 02:10 AM|LINK
I am new in using the task scheduler. I'm using SCHTASKS to run my C# Program. How will I check the rights? Below is my .exe file.
Thanks.
ignatandrei
All-Star
137716 Points
22159 Posts
Moderator
MVP
Re: batch run error
Apr 02, 2012 05:06 AM|LINK
This is not exe, this is bat.
This creates a task Branches in taskscheduler under %user_id% and either
1. the task Branches gives you an error
either
2. the running of the bat gives you an error, means asp.net user have not enough rights
quickmelt
Member
83 Points
60 Posts
Re: batch run error
Apr 02, 2012 09:56 AM|LINK
yes, you are correct. that's my bat file which is used to create a task. it's working already, i just added /RL HIGHEST to get the highest privilege.
thank you.