Dean, Thanks for the response... I have been struggling with this for weeks. I am currently in development stages and I am running this console application on my laptop. I don't know if indexing is turned on... how would I check?
Travis D. Falls | Consultant RAFT.Net IT | 860.547.4070 | [EMAIL PROTECTED] -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] Behalf Of Dean Fiala Sent: Thursday, November 17, 2005 10:29 PM To: [email protected] Subject: Re: [AspNetAnyQuestionIsOk] File still in use error Travis, Do you have the Indexing Service on, on this server? If so, turning it offf, might solve the problem. On 11/17/05, Falls, Travis D (HTSC, CASD) <[EMAIL PROTECTED]> wrote: > I have the following method in a utility class I created that is instantiated > via a singleton. I think begin my file work load that can be 100 files... I > start 10 threads that do a copy, rename, delete, script work load. During > these threads I create files based on the work item's ID for example > S053R.state with the method below. Every step of the way I call the below > method to serialize an object to maintain state incase the system goes down > or the transfer fails. > > My questions: > > 1. Why do I keep getting the: > 2005-11-17 14:22:40,305 [2096] ERROR > com.TheHartford.HTSC.RAFT.FileWatcher.Utilities [(null)] -EXCEPTION: Access > to the path "C:\RAFT.NET\Service\State\IDs\TDF02.state" is denied. > System.UnauthorizedAccessException: Access to the path > "C:\RAFT.NET\Service\State\IDs\TDF02.state" is denied. > at System.IO.__Error.WinIOError(Int32 errorCode, String str) > at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess > access, > FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean > bFromProxy) > at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess > access, FileShare share, Int32 bufferSize) > at System.IO.FileInfo.Create() > at com.TheHartford.HTSC.RAFT.FileWatcher.Utilities.DoSerialize(String > Path, String Name, Object o) in c:\raft\filewatcher\code\utilities.cs:line 438 > > 2. would it be better to create a state engine using MSMQ instead? > > Any help would be greatly appreciated; I have been struggling with this one > for a while. I feel like I am closing everything and I know this is the only > method and process that creates and deletes these files. > > > public void DoSerialize(String Path, String Name, object o) { > lock (syncRoot2){ > try{ > object j = new object(); > j = o; > DirectoryInfo di = new DirectoryInfo(Path); > FileInfo[] finfos = di.GetFiles(Name); > for(int i = 0; i < finfos.Length; i++){ > FileInfo file = finfos[i]; > try{ > file.Delete(); > } > catch (FileNotFoundException fnfe){ > log.Error("FILE NOT FOUND: " + > fnfe.ToString() + " " + fnfe.Message); > } > catch (IOException fnfe){ > log.Error("IO EXCEPTION: " + > fnfe.ToString() + " " + fnfe.Message); > } > } > FileInfo fi = new FileInfo(Path + Name); > using (Stream myFileStream = fi.Create()){ > SoapFormatter serializer = new > SoapFormatter(); > serializer.Serialize(myFileStream, j); > DoGarbageCollection(); > } > } > catch (Exception ex){ > DoMessaging("FWE00017", ex.Message + " " + ex.ToString(), > GetDateNowDateTime()); > log.Error("EXCEPTION: " + ex.Message + " " + ex.ToString()); > } > } > > > ************************************************************************* > This communication, including attachments, is > for the exclusive use of addressee and may contain proprietary, > confidential and/or privileged information. If you are not the intended > recipient, any use, copying, disclosure, dissemination or distribution is > strictly prohibited. If you are not the intended recipient, please notify > the sender immediately by return e-mail, delete this communication and > destroy all copies. > ************************************************************************* > > > > > > Yahoo! Groups Links > > > > > > > -- Dean Fiala Very Practical Software, Inc http://www.vpsw.com Yahoo! Groups Links ------------------------ Yahoo! Groups Sponsor --------------------~--> 1.2 million kids a year are victims of human trafficking. Stop slavery. http://us.click.yahoo.com/WpTY2A/izNLAA/yQLSAA/saFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
