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

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

最好加上Dispose

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

System.IO.File.Create 不会自动释放,一定要Dispose的更多相关文章

  1. 详解C#中System.IO.File类和System.IO.FileInfo类的用法

    System.IO.File类和System.IO.FileInfo类主要提供有关文件的各种操作,在使用时需要引用System.IO命名空间.下面通过程序实例来介绍其主要属性和方法. (1) 文件打开 ...

  2. System.IO.File类和System.IO.FileInfo类

    1.System.IO.File类 ※文件create, copy,move,SetAttributes,open,exists ※由于File.Create方法默认向所有用户授予对新文件的完全读写. ...

  3. IIS目录下文件共享后System.IO.File.Exists返回false

    场景:在iis目录下,因为特殊需要共享一个文件夹,给到其他的技术人员访问,突然发现小小的操作,搞“大”了,使用 string path = Server.MapPath("~/file/te ...

  4. System.IO.File.WriteAllText("log.txt", "dddd");

    System.IO.File.WriteAllText("log.txt", "dddd");

  5. 关于 System.IO.File.Exists 需要注意的事项

    各位:   .NET Framework 本省在设计的时候,他对于异常没有完全做到抛出,这样可能会有很多意想不到的问题.   比如 你在asp.net 应用程序中判断文件是否存在,这个文件可能是一个共 ...

  6. system.io.file创建

    在实际开发中,如果用的文件名不能确定位置.或名字.可以使用GUID类来命名函数.Guid 结构标识全局唯一标示符.其NewGuid结构可以初始化一个新历.该方法语法格式如下: public stati ...

  7. C# System.IO.File

    using System; using System.IO; class Test { public static void Main() { string path = @"c:\temp ...

  8. 未处理的异常:system.io.file load exception:无法加载文件或程序集“ 。。。。 找到的程序集的清单定义与程序集引用不匹配。

    问题描述: 添加控制器的时候,突然就报了这个错: Unhandled Exception: System.IO.FileLoadException: Could not load file or as ...

  9. 安卓上为什么不能用system.io.file读取streammingAssets目录下的文件

    首先,看文档: Streaming Assets   Most assets in Unity are combined into the project when it is built. Howe ...

随机推荐

  1. [LintCode] Evaluate Reverse Polish Notation 计算逆波兰表达式

    Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, ...

  2. [CareerCup] 16.6 Synchronized Method 同步方法

    16.6 You are given a class with synchronized method A and a normal method B. If you have two threads ...

  3. List相关知识点.......课堂加整理

    package lis0924; //接口List(列表) import java.util.ArrayList; import java.util.Iterator; import java.uti ...

  4. java.lang.StringBuilder

    1.StringBuilder 的对象和 String 的对象类似,并且 StringBuilder 的对象能被修改.Internally,这个对象被当做一个包含一系列字符的可变长度的数组对待.这个序 ...

  5. 2016HUAS暑假集训训练2 A - Is It A Tree?

    Description A tree is a well-known data structure that is either empty (null, void, nothing) or is a ...

  6. NeuSoft(2)添加系统调用

    1.下载内核 apt-get install linux-source 在/usr/src下 2.解压内核 cd /usr/src tar -jxvf linux-source-3.2.0.tar.b ...

  7. WooCommerce代码收集

    修改首页和分类页面每页产品数量 每页显示多少产品默认跟随设置 » 阅读设置 » 博客页面至多显示的值,若要产品索引页和博文索引页使用不同的设置,可以使用下面的代码为产品索引页单独设置每页产品数. ad ...

  8. ScriptManager.RegisterStartupScript

    如果页面中不用Ajax,cs中运行某段js代码方式可以是:Page.ClientScript.RegisterStartupScript(Page.GetType(), "", & ...

  9. ext3grep 模拟恢复删除文件

    一,下载ext3grep-0.10.1.tar.gz 点此下载 二,安装 #tar zxvf ext3grep-0.10.1.tar.gz #cd ext3grep-0.10.1 #./configu ...

  10. dns服务

    http://33024.blog.163.com/blog/static/12307042220119179237568/