私はアプリケーションのログインを有効にするために.Net tracelistenerを使用しています。私のアプリケーションはマルチスレッドの.Netサービスです。重い負荷の下で.Netトレースは、次のエラーをスローします。 これはなぜ起こっているのか、これに対する解決策があるのか誰にも分かっていますか?.Net tracelistenerの問題
System.UnhandledExceptionEventArgs
System.IO.IOException
mscorlib
The process cannot access the file 'C:\035_Prg.log' because it is being used by another process.
Server stack trace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at 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)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at System.Diagnostics.TraceListener.WriteHeader(String source, TraceEventType eventType, Int32 id)
at System.Diagnostics.TraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, String format, Object[] args)
at System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String format, Object[] args)
at System.Diagnostics.TraceSource.TraceInformation(String message)
サービスをホストしているサービスまたはIISを停止しようとしましたか、タスクマネージャでasp_netプロセスを停止しましたか? – Kuncevic
同じTraceListenerを2回追加していませんか?これはこの種の問題を引き起こす可能性があります。それ以外の場合は、使用しているTraceListenerクラスとは何ですか? –
私はtracelistenersのTracesourceクラスを使用しています。 – user597955