“再生事件日志源”后丢弃的例外
原标题:Exception thrown after "Refresh EventLog Source"
I ve enabled NLog internal logging to figure out an issue where our logs suddenly stop sometimes.
Might be unrelated to the issue I m trying to figure out but I ve gotten this Exception for one of the targets (FileTarget logging with ConcurrentWrites = true, wrapped by AsyncTargetWrapper).
This is a file where a couple of running applications should be able to write to. Before this error this file is already created and written to
I m currently running NLog version 5.2.8 on all applications
The error is:
2024-07-22 12:35:33.2512 Debug EventLogTarget([unnamed]): Refresh EventLog Source Company.WCF.Client.Console - Client and Log Application
2024-07-22 12:35:33.2512 Debug FileTarget([unnamed]): Preparing for new file: C:ProgramDataCompanyLogsAllExceptions.txt
2024-07-22 12:35:33.2512 Debug FileTarget([unnamed]): Creating file appender: C:ProgramDataCompanyLogsAllExceptions.txt
2024-07-22 12:35:33.2512 Warn FileTarget([unnamed]): Failed to create file appender: C:ProgramDataCompanyLogsAllExceptions.txt Exception: System.UnauthorizedAccessException: Access to the path C:ProgramDataCompanyLogsAllExceptions.txt is denied.
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, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileSystemRights rights, FileShare share, Int32 bufferSize, FileOptions options)
at NLog.Internal.FileAppenders.WindowsMultiProcessFileAppender.CreateAppendOnlyFile(String fileName)
at NLog.Internal.FileAppenders.WindowsMultiProcessFileAppender..ctor(String fileName, ICreateFileParameters parameters)
at NLog.Internal.FileAppenders.WindowsMultiProcessFileAppender.Factory.NLog.Internal.FileAppenders.IFileAppenderFactory.Open(String fileName, ICreateFileParameters parameters)
at NLog.Internal.FileAppenders.FileAppenderCache.CreateAppender(String fileName, Int32 freeSpot)
Could I get an explanation on why this could be triggered? This seems to have happened while the applications were running on my development machine, without any intervention at that timestamp
问题回答
System.UnauthorizedAccessException - You probably don t have access to that path under the credentials NLog is running under. If you change the path to something that is open like C:Temp or something with less permissions, does it work?
相关问题
What is the use of `default` keyword in C#?
What is the use of default keyword in C#?
Is it introduced in C# 3.0 ?
Anyone feel like passing it forward?
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs.
...
NSArray s, Primitive types and Boxing Oh My!
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits.
Now here s the question: I feel really inclined to create some type of ...
C# Marshal / Pinvoke CBitmap?
I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class.
My import looks like this:
[DllImport(@"test.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr ...
ADO.NET Entity Framework Association of Entities by Value Range
I have two EF entities. One has a property called HouseNumber. The other has two properties, one called StartHouseNumber and one called EndHouseNumber.
I want to create a many to many association ...
How to Use Ghostscript DLL to convert PDF to PDF/A
How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...
What is the most efficient keyvalue pair for ordering?
Since I cannot order my dictionary, what is the best way of going about taking key value pairs and also maintaing an index?
Linqy no matchy
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control.
...