at System.Web.ProcessModelInfo.GetCurrentProcessInfo()
at ...
Nice feature.
Every web application we have use the same logging technique :
ProcessInfo piUser = ProcessModelInfo.GetCurrentProcessInfo();
swLogFile.WriteLine("{0} - Process ID {1} started at {2} - Memory peak : {3}", dtNow.ToLongTimeString(), piUser.ProcessID, piUser.StartTime, piUser.PeakMemoryUsed);
swLogFile.WriteLine("{0} - Status : {1}", dtNow.ToLongTimeString(), piUser.Status);
swLogFile.WriteLine("{0} - Shutdown Reason : {1}", dtNow.ToLongTimeString(), piUser.ShutdownReason);
swLogFile.WriteLine("{0} - Method : {1}", dtNow.ToLongTimeString(), ProcedureName);
swLogFile.WriteLine("{0} - Message : {1}", dtNow.ToLongTimeString(), e.Message);
swLogFile.WriteLine("{0} - Detailled error file : {1}", dtNow.ToLongTimeString(), WriteErrorLog(e));
On all our W2k web servers, this works well.
On all the WXP dev stations this works well.
On the new W2k3 web server, this fails miserably.
So we just have to change it to this :
try
{ piUser = ProcessModelInfo.GetCurrentProcessInfo(); }
catch
{//We're not running under ASP.NET process model.
piUser = null;
}
And make sure that the Append to StreamWriter doesn't want to access
piUser.ProcessID
Aucun commentaire:
Enregistrer un commentaire