询问者
关于C# Process的问题

问题
全部回复
-
把你访问这个文件的代码贴出来看看
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP -
检查你的文件访问代码,如果用了实现IDisposable的对象,在用完之后都要dispose的
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP -
public class FetchProcessBase : IDisposable
~FetchProcessBase()
{
this.Dispose(false);
}public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}protected virtual void Dispose(bool disposing)
{
if (disposing)
{
if (this.facade != null)
{
this.facade.Dispose();
}
}
}第二个Dispose是在finally中的,它try的部分在load和save之间。
也就是说当执行析构函数this.Dispose(false);的时候,并没有释放FetchProcessBase?
-
"这个程序应该是没问题的,因为它是每个月跑一次,处理一个当月的xml文件,山个月的正常处理了,这个月的报错了。"
可以下载个ProcessExplorer工具,查查是哪个进程占用了这个文件。它也具备杀的功能。不用重启服务器。
下载地址:http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx