开发者

Thread is being abortted while deleting folders [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

I am usi开发者_StackOverflow社区ng web service method to run scripts it generated the some unwanted folders i want to delete folders after or before the script runs.

ProcessStatus newProcess =
                    new ProcessStatus(
                            String.Format(
                                "{0}, started:{1}",
                                projectName, DateTime.Now.ToString("HH:m:ss")
                                )
                            );
newProcess.buildData = new BuildHelper(deviceName, projectName, owner, deviceFolder,  Constants.serverContentpath, Constants.buildInfoFilePath);
ProcessStatuses processStatus = new ProcessStatuses();
ArrayList allProcesses = processStatus.Get();
ArrayList.Synchronized(allProcesses).Add(newProcess);
ThreadPool.QueueUserWorkItem(
                        new WaitCallback(processStatus.startProcessing),
                        new object[] { newProcess, allProcesses }
                        );
//Thread th = new Thread(new ThreadStart(delegate {
//    processStatus.startProcessing(new object[] { newProcess, allProcesses });
//}));
//th.Start();
processStatus = null;
newProcess = null;
_deviceBuildMonitor = null;


Let me first reframe your question as i understand.

Your webservice has created some temp files are you spawing off a thred to do some cleanup operations.

If your webservice is hosted on an IIS server then the problem could be that you IIS App pool is restarting on deletion(File Change Notification) of the directory. Try executing this code either in your app start event or before you try deleting the directory

var theRuntime = typeof(HttpRuntime).GetField("_theRuntime", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null);
var fcmField = typeof(HttpRuntime).GetField("_fcm", BindingFlags.NonPublic | BindingFlags.Instance);

var fcm = fcmField.GetValue(theRuntime);
fcmField.FieldType.GetMethod("Stop", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(fcm, null);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜