asp.net主机设置经验
您可以通过以下设置控制asp.net对服务器内存的占用。并能设置aspnet进程定时重建(类似IIS6中AppPool里的定时重启),这样可以避免服务器长时间运行aspnet占用大量空闲内存,有利于提高aspnet运行效率。
aspnet配置文件位置为
CWINDOWSMicrosoft.NETFrameworkv1.1.4322CONFIGmachine.config
用文本编辑器打开该文件,找到以内容按注释修改
processModel
enable=true
timeout=010000 --超时时间,指定多长时间后重建aspnet进程,建议设为数小时,格式小时分钟秒
idleTimeout=002000 --aspnet多长时间无动作时关闭进程,建议数十分钟
...
memoryLimit=40 --aspnet最多占用服务器内存数,默认40%
-------------------
默认情况下web.config修改后,asp.net程序会被重启。为了防止程序重启,要修改machine.config 文件。
machine.config默认在C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG目录下。
<section name="appSettings" type="System.Configuration.AppSettingsSection, System.Configuration, Version=2.0.0.0,Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
restartOnExternalChanges="false" requirePermission="false" />
restartOnExternalChanges设置为false,程序就不会重启了。
文章出处:DIY部落(http://www.diybl.com/course/1_web/webjs/20071128/88711.html)
相关文档:
首先添加命名空间
using System.Data.OleDb;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
strfile = Request.QueryString["filename"];//从其他页面传过来的文件路径
Excel(strfile);
}
}
private v ......
//TransmitFile实现下载
protected void Button1_Click(object sender, EventArgs e)
{
/*
......
asp.net文件上传(0)
2009年04月13日 星期一 下午 06:11
Default.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"& ......
@Page指令位于每个ASP.NET页面的顶部,告诉ASP.NET这个具体页面使用什么属性,以及该页面继承的用户控件。ASP.NET页面
@Page指令属性有:AspCompat、Async、AsyncTimeout、AutoEventWireup、Buffer、
ClassName、ClientIDMode、CodeBehind、
CodeFile、CodeFileBaseClass、CodePage、CompilationMode 、ContentType、
......