在尝试使用Microsoft.VisualBasic.Logging.FileLogTraceListener
The object is tyring 访问ctor中的某个文件夹时(并在其中写入一些东西!)。
异常发生在ctor中
现在一些示例代码...
FileLogTraceListener logger = new FileLogTraceListener("theName");
Writer.BaseFileName = "Writer";
Writer.CustomLocation = HttpContext.Current.Server.MapPath("/logs");
Writer.LogFileCreationSchedule = LogFileCreationScheduleOption.Weekly;
Writer.TraceOutputOptions = TraceOptions.Timestamp;
Writer.AutoFlush = true;
Writer.Delimiter = "|";
Writer.DiskSpaceExhaustedBehavior = DiskSpaceExhaustedOption.DiscardMessages;
Writer.Location = LogFileLocation.Custom;
Writer.Encoding = UTF8Encoding.UTF8;
Writer.IncludeHostName = false;
Writer.MaxFileSize = (1024 * 1024) * 5;
Writer.WriteLine(message, category);
[UnauthorizedAccessException: Access to the path '\Microsoft Corporation\Internet Information Services\7.0.6000.16386' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +10797222
System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost) +10589262
System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost) +136
System.IO.Directory.CreateDirectory(String path) +33
帮助任何人?