且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

文件自动被IIS 8锁定(C#,ASP.net MVC剃须刀)

更新时间:2023-02-14 22:43:50

我已找到问题和解决方案.在控制器中,一个识别图像尺寸的功能(对基于移动的应用程序应用了一些CSS规则)导致了问题.

I have found the issue and solution. In controller an function to identify the image dimension (to apply some css rule for mobile based app) was causing the issue.

System.Drawing.Image img = System.Drawing.Image.FromFile(Server.MapPath("~") + spe_Fil.ImagePath);

未放置img对象,因此应用了锁定.添加img.dispose()后,文件锁定问题得到解决.

the img object was not disposed and hence a lock was applied. After adding img.dispose(), file locking issue got resolved.