2017-04-22 56 views
-2

アプリケーションの実行後、このエラーメッセージが表示されます。どうして?あなたの答えを教えてくれたら嬉しいです。ここSystem.IO.IOException:プロセスが別のプロセスで使用されているため、ファイル 'C: RDS RDS.txt'にアクセスできません。

は私のForm1のソースコードです:https://github.com/betimen/txtRDS/blob/master/Form1.cs

(エラーメッセージ)

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box. 
************** Exception Text ************** 
System.IO.IOException: The process cannot access the file 'C:\RDS\RDS.txt' because it is being used by another process. 
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, Boolean useLongPath, Boolean checkHost) 
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) 
at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost) 
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost) 
at System.IO.StreamWriter..ctor(String path) 
at WindowsFormsApplication2.Form1.timer1_Tick(Object sender, EventArgs e) 
at System.Windows.Forms.Timer.OnTick(EventArgs e) 
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) 
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 
************** Loaded Assemblies ************** 
mscorlib 
Assembly Version: 4.0.0.0 
Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL 
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll 
---------------------------------------- 
txtRDS 
Assembly Version: 1.0.0.0 
Win32 Version: 1.0.0.0 
CodeBase: file:///C:/Users/hevi%20sms/Downloads/txtRDS.exe 
---------------------------------------- 
System.Windows.Forms 
Assembly Version: 4.0.0.0 
Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL 
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll 
---------------------------------------- 
System 
Assembly Version: 4.0.0.0 
Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL 
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll 
---------------------------------------- 
System.Drawing 
Assembly Version: 4.0.0.0 
Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL 
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll 
---------------------------------------- 
Accessibility 
Assembly Version: 4.0.0.0 
Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL 
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll 
---------------------------------------- 
System.Configuration 
Assembly Version: 4.0.0.0 
Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL 
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll 
---------------------------------------- 
System.Xml 
Assembly Version: 4.0.0.0 
Win32 Version: 4.5.27.0 built by: FX453PREVIEWREL 
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll 
---------------------------------------- 
************** JIT Debugging ************** 
To enable just-in-time (JIT) debugging, the .config file for this 
application or computer (machine.config) must have the 
jitDebugging value set in the system.windows.forms section. 
The application must also be compiled with debugging 
enabled. 
For example: 
<configuration> 
<system.windows.forms jitDebugging="true" /> 
</configuration> 
When JIT debugging is enabled, any unhandled exception 
will be sent to the JIT debugger registered on the computer 
rather than be handled by this dialog box. 
+0

あなたは私の答えをチェックしていますか?それはあなたのための助けですか? – SMW

+0

はい私はあなたの答えを読んで、私は仕事に忙しかった私は今あなたに返信できませんでした私は自由な時間があり、私はあなたの答えに1分返答しています – Betimen

+0

私は現時点で@SachithMWの答えを読むことができません。任意の意見ですか? – Betimen

答えて

-1

あなたは別のアプリケーションで開かれたテキストファイルを持っていますか?テキストファイルが開かれているプログラムがアクセスしないように思えます。これは、どのアプリケーションがそれをしているかを知ることができます:
http://www.techsupportalert.com/content/how-find-out-which-windows-process-using-file.htm

+0

いいえ別のアプリケーションでそのテキストファイルを開いていませんでした。なぜなら、Form1のテキストボックスのテキストが書かれて正常に保存されているかどうかを確認するために、テキストファイルをメモ帳で開くと、タイマーがリセットされてから数秒後にエラーがスローされてしまうからです。私は前にテストしました。アプリケーションはテキストファイルに保存されているので、textbox2はテキストファイルの内容を表示するので、メモ帳で開く必要はありません。アプリケーションはコンピュータで7/24を実行する必要があり、閉じてはいけません。テキストファイルはデフォルトでtextbox1.textまたはtextbox4.textのデータと共に10秒ごとに保存されるためです。 1-2時間後にエラーをスローします。 – Betimen

+0

10秒ごとに同じファイルに書き込もうとしている場合は、そのファイルは実行時に1つのアプリケーションでのみ使用されます。ファイルを開いたままにしておき、アプリケーションが終了するまで閉じることはできません。これにより、問題が解決するはずです。 – Informat

+0

私は理解していますし、それは同じテキストファイルでなければなりません。そのテキストファイルの内容を読み取るデバイスがあるためです。だから私は "近い"を使用する必要があります。私はあなたのリンクをチェックし、アクセスを妨げるプロセスはありません。私はまだ "リソースモニタ"と "プロセスエクスプローラ"画面で待っています – Betimen

関連する問題