“/”应用程序中的服务器错误。

文件“D:\hosts\www.paopaoche.net\log\20240329-09.log”正由另一进程使用,因此该进程无法访问此文件。

说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.IO.IOException: 文件“D:\hosts\www.paopaoche.net\log\20240329-09.log”正由另一进程使用,因此该进程无法访问此文件。

源错误:


行 46:                 string path = context.Server.MapPath("/log/" + DateTime.Now.ToString("yyyyMMdd-HH") + ".log");
行 47:                 string cont = DateTime.Now.ToString() + " url: " + context.Request.Url.ToString() + "  location: " + location + "\r\n";
行 48:                 System.IO.File.AppendAllText(path, cont);
行 49:             }
行 50:         }

源文件: d:\hosts\www.paopaoche.net\App_Code\SafeModule.cs    行: 48

堆栈跟踪:


[IOException: 文件“D:\hosts\www.paopaoche.net\log\20240329-09.log”正由另一进程使用,因此该进程无法访问此文件。]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +935
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +1242
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +146
   System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost) +126
   System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost) +105
   System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding) +31
   System.IO.File.InternalAppendAllText(String path, String contents, Encoding encoding) +65
   SafeModule.OnPreSend(Object source, EventArgs e) in d:\hosts\www.paopaoche.net\App_Code\SafeModule.cs:48
   System.Web.SendResponseExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +188
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +75
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +93


版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.8.4494.0