I am trying to use Microsoft.VisualBasic.Logging.FileLogTraceListener in my ASP.NET MVC 3 application (vb.net). It works on my computer, but it gives an error when starting from IIS 6. Here is the web.config that I use:
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.diagnostics> <trace autoflush="true" /> <sources> <source name="requests" switchValue="All"> <listeners> <remove name="default" /> <add name="txtfile" /> </listeners> </source> </sources> <sharedListeners> <add name="txtfile" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" location="custom" customlocation="D:\PROJECTS\saidproject\App_Data" logfilecreationschedule="weekly" /> </sharedListeners> </system.diagnostics> </configuration>
The error I received is:
System.Configuration.ConfigurationErrorsException: Could not create Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL. ---> System.UnauthorizedAccessException: Access to the path 'C:\Documents and Settings\Default User\Application Data\Microsoft Corporation\Internet Information Services\6.0.3790.3959' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj) at System.IO.Directory.CreateDirectory(String path) at System.Windows.Forms.Application.GetDataPath(String basePath) at System.Windows.Forms.Application.get_UserAppDataPath() at Microsoft.VisualBasic.Logging.FileLogTraceListener..ctor(String name) at Microsoft.VisualBasic.Logging.FileLogTraceListener..ctor()
It looks like FileLogTraceListener tried to write C:\Documents and Settings\Default User\Application Data\Microsoft Corporation\Internet Information Services\6.0.3790.3959
and failed.
In fact, the Microsoft Corporation\Internet Information Services\6.0.3790.3959
does not exist inside the Default User\Application Data
. I tried to create it by assigning full access to everyone, but I still have the same error.
Can I use Microsoft.VisualBasic.Logging.FileLogTraceListener from an ASP.NET MVC application?
source share