Я пытаюсь использовать Microsoft.VisualBasic.Logging.FileLogTraceListener в моем приложении ASP.NET MVC 3 (vb.net). Он работает на моем ПК разработчика, но выдает ошибку при запуске с сервера IIS 6. Вот web.config, который я использую:
<?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>
Я получил следующую ошибку:
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()
Похоже, FileLogTraceListener попытался записать в C:\Documents and Settings\Default User\Application Data\Microsoft Corporation\Internet Information Services\6.0.3790.3959
и не смог.
На самом деле папка Microsoft Corporation\Internet Information Services\6.0.3790.3959
не существует в Default User\Application Data
. Я попытался создать его, назначив всем полный доступ, но все равно получил ту же ошибку.
Можно ли использовать Microsoft.VisualBasic.Logging.FileLogTraceListener из приложения ASP.NET MVC?