这样会导致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. 复选框,:checked

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. javascript平时小例子⑥(简易计算器的制作)

    <!doctype html><html><head><meta charset="utf-8"><title>无标题文 ...

  3. 创建catalog数据库

    1数据库版本 2环境准备 3目录数据库准备 4创建目录数据库 5使用目录数据库

  4. 一个人的旅行-Floyd

    一个人的旅行 Time Limit : 1000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submis ...

  5. javascript控制开始日期,和结束日期在同一个月

    /* * 控制开始日期,和结束日期 * 开始日期为当前月份,结束日期为当天 * 开始日期为之前月份,结束日期为最后一天 * @return string * @poseidon 2015-9-17 * ...

  6. Openfire 的安装和配置

    1. 下载最新的openfire安装文件 官方下载站点:http://www.igniterealtime.org/downloads/index.jsp#openfire 下载地址: Exe:htt ...

  7. java json与对象或者集合互转

    package open_exe; public class User { private int id; private String name; private String gender; pu ...

  8. IHttpModule

    随便写一个类继承IHttpModule 实现IHttpModule中的两个方法 Init() Dispose() public void Init(HttpApplication context) { ...

  9. py操作mysql

    1.操作mysql的标准流程 import pymysql conn = pymysql.connect(host = "127.0.0.1", port = 3306,user ...

  10. centos 下 安装zookpeer

    tar xvf zookeeper-3.4.6.tar.gz cd /usr/local/zookpeer/ mkdir /var/zookpeer mkdir /var/zookpeer/data ...