1
我已经使用以下代码将跟踪日志保存到表存储中。 我使用Windows Azure的SKD版本2.2无法将日志保存到Windows Azure表存储中?
System.Diagnostics.Trace.TraceError("START Log");
在web.config
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
还添加代码也加入listener
在webrole.cs
public override bool OnStart()
{
StartDiagnostics();
return base.OnStart();
}
private void StartDiagnostics()
{
DiagnosticMonitorConfiguration dmc = DiagnosticMonitor.GetDefaultInitialConfiguration();
TimeSpan tsOneMinute = TimeSpan.FromMinutes(1);
// Transfer logs to storage every minute
dmc.Logs.ScheduledTransferPeriod = tsOneMinute;
// Transfer verbose, critical, etc. logs
dmc.Logs.ScheduledTransferLogLevelFilter = LogLevel.Information;
// Start up the diagnostic manager with the given configuration.
try
{
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", dmc);
}
catch (Exception exp)
{
}
}
仍然得到错误:500内部服务器错误
500内部错误来自*哪里*? – James
用户上下文 - 身份验证 我检查当我在web.config中插入监听器代码,然后这个错误来 – Neo