System.IO.File.Create 不会自动释放,一定要Dispose

这样会导致W3P进程一直占用这个文件

System.IO.File.Create(HttpContext.Current.Server.MapPath(strName)) 

 

最好加上Dispose

System.IO.File.Create(HttpContext.Current.Server.MapPath(strName)).Dispose()

转载于:https://www.cnblogs.com/LCX/p/4307845.html

你可能感兴趣的:(System.IO.File.Create 不会自动释放,一定要Dispose)