当前位置: 移动技术网 > IT编程>开发语言>c# > C#如何控制IIS动态添加删除网站详解

C#如何控制IIS动态添加删除网站详解

2020年03月09日  | 移动技术网IT编程  | 我要评论

我的目的是在winform程序里面,可以直接启动一个http服务端,给下游客户连接使用。

查找相关技术,有两种方法:

1.使用c#动态添加网站应用到iis中,借用iis的管理能力来提供http接口。本文即对此做说明

2.在winform程序中实现web服务器逻辑,自己监听和管理客户端请求;

利用iis7自带类库管理iis现在变的更强大更方便,而完全可以不需要用direcotryentry这个类了(乐博网中很多.net管理iis6.0的文章都用到了direcotryentry这个类 ),microsoft.web.administration.dll位于iis的目录(%windir%\\system32\\inetsrv)下,使用时需要引用,它基本上可以管理iis7的各项配置。

这个类库的主体结构如下:

 

这里只举几个例子说明一下基本功能,更多功能请参考msdn。

建立站点

string sitename="乐博网"; //站点名称
string bindargs="*:80:"; //绑定参数,注意格式
string apl="http"; //类型
string path="e:\\乐博网"; //网站路径
servermanager sm = new servermanager();
sm.sites.add(sitename,apl,bindargs,path);
sm.commitchanges();

修改站点

site site=sm.sites["newsite"];
site.name=sitename;
site.bindings[0].endpoint.port=9999;
site.applications[0].virtualdirectories[0].physicalpath=path;
sm.commitchanges();

删除站点

site site=sm.sites["乐博网"];
sm.sites.remove(site);
sm.commitchanges();

站点操作

方法一:

#region createwebsite 添加网站

  public string createwebsite(string serverid, string servercomment, string defaultvrootpath, string hostname, string ip, string port)
  {
   try
   {
    managementobject ow3svc = new managementobject (_scope, new managementpath(@"iiswebservice='w3svc'"), null);
    if (iswebsiteexists (serverid))
    {
     return "site already exists...";
    }

    managementbaseobject inputparameters = ow3svc.getmethodparameters ("createnewsite");
    managementbaseobject[] serverbinding = new managementbaseobject[1];

    serverbinding[0] = createserverbinding(hostname, ip, port);

    inputparameters["servercomment"] = servercomment;
    inputparameters["serverbindings"] = serverbinding;
    inputparameters["pathofrootvirtualdir"] = defaultvrootpath;
    inputparameters["serverid"] = serverid;

    managementbaseobject outparameter = null;
    outparameter = ow3svc.invokemethod("createnewsite", inputparameters, null);

    // 启动网站
    string servername = "w3svc/" + serverid;
    managementobject website = new managementobject(_scope, new managementpath(@"iiswebserver='" + servername + "'"), null);
    website.invokemethod("start", null);

    return (string)outparameter.properties["returnvalue"].value;

   }
   catch (exception ex)
   {
    return ex.message;
   }

  }

  public managementobject createserverbinding(string hostname, string ip, string port)
  {
   try
   {
    managementclass classbinding = new managementclass(_scope, new managementpath("serverbinding"), null);

    managementobject serverbinding = classbinding.createinstance();

    serverbinding.properties["hostname"].value = hostname;
    serverbinding.properties["ip"].value = ip;
    serverbinding.properties["port"].value = port;
    serverbinding.put();

    return serverbinding;
   }
   catch
   {
    return null;
   }
  }
  
  #endregion

  #region 添加网站事件

  protected void addwebsite_click(object sender, eventargs e)
  {
   iismanager iis = new iismanager();

   iis.connect();

   string serverid = "5556";
   string servercomment = "create website";
   string defaultvrootpath = @"d:\web";
   string hostname = "world";
   string ip = "";
   string port = "9898";

   returnmessage.text = iis.createwebsite(serverid,servercomment,defaultvrootpath,hostname,ip,port);
  }

  #endregion

  #region deletesite 删除站点

  public string deletesite(string serverid)
  {
   try
   {
    string servername = "w3svc/" + serverid;
    managementobject website = new managementobject(_scope, new managementpath(@"iiswebserver='" + servername + "'"), null);
    website.invokemethod("stop", null);
    website.delete();
    website = null;

    return "delete the site succesfully!";
   }
   catch (exception deleteex)
   {
    return deleteex.message;
   }
  }

  #endregion

方法二:

using system;
using system.collections.generic;
using system.text;
using system.directoryservices;
namespace windowsapplication1
{
 class iismanager
 {
  public iismanager()
  {
  }
  public static string virdirschemaname = "iiswebvirtualdir";
  private string _servername;
  public string servername
  {
   get
   {
    return _servername;
   }
   set
   {
    _servername = value;
   }
  }

  /// <summary>  
  /// 创建網站或虚拟目录 
  /// </summary>  
  /// <param name="website">服务器站点名称(localhost)</param>  
  /// <param name="vdirname">虚拟目录名称</param>  
  /// <param name="path">實際路徑</param>  
  /// <param name="rootdir">true=網站;false=虛擬目錄</param> 
  /// <param name="iauth">设置目录的安全性,0不允许匿名访问,1为允许,2基本身份验证,3允许匿名+基本身份验证,4整合windows驗證,5允许匿名+整合windows驗證...更多請查閱msdn</param>  
  /// <param name="websitenum">1</param>  
  /// <param name="servername">一般為localhost</param> 
  /// <returns></returns> 
  public bool createwebsite(string website, string vdirname, string path, bool rootdir, int iauth, int websitenum, string servername)
  {
   try
   {
    system.directoryservices.directoryentry iisschema;
    system.directoryservices.directoryentry iisadmin;
    system.directoryservices.directoryentry vdir;
    bool iisundernt;

    // 
    // 确定iis版本 
    //   
    iisschema = new system.directoryservices.directoryentry("iis://" + servername + "/schema/appisolated");
    if (iisschema.properties["syntax"].value.tostring().toupper() == "boolean")
     iisundernt = true;
    else
     iisundernt = false;
    iisschema.dispose();
    //   
    // get the admin object   
    // 获得管理权限  
    //   
    iisadmin = new system.directoryservices.directoryentry("iis://" + servername + "/w3svc/" + websitenum + "/root");
    //   
    // if we're not creating a root directory   
    // 如果我们不能创建一个根目录   
    //    
    if (!rootdir)
    {
     //    
     // if the virtual directory already exists then delete it    
     // 如果虚拟目录已经存在则删除  
     //
     foreach (system.directoryservices.directoryentry v in iisadmin.children)
     {
      if (v.name == vdirname)
      {
       // delete the specified virtual directory if it already exists 
       try
       {
        iisadmin.invoke("delete", new string[] { v.schemaclassname, vdirname });
        iisadmin.commitchanges();
       }
       catch (exception ex)
       {
        throw ex;
       }
      }
     }
    }
    //   
    // create the virtual directory  
    // 创建一个虚拟目录  
    //   
    if (!rootdir)
    {
     vdir = iisadmin.children.add(vdirname, "iiswebvirtualdir");
    }
    else
    {
     vdir = iisadmin;
    }
    //   
    // make it a web application  
    // 创建一个web应用   
    //
    if (iisundernt)
    {
     vdir.invoke("appcreate", false);
    }
    else
    {
     vdir.invoke("appcreate", true);
    }
    //   
    // setup the vdir  
    // 安装虚拟目录  
    //appfriendlyname,propertyname,, bool chkread,bool chkwrite, bool chkexecute, bool chkscript,, true, false, false, true 
    vdir.properties["appfriendlyname"][0] = vdirname; //应用程序名称 
    vdir.properties["accessread"][0] = true; //设置读取权限 
    vdir.properties["accessexecute"][0] = false;
    vdir.properties["accesswrite"][0] = false;
    vdir.properties["accessscript"][0] = true; //执行权限[純腳本] 
    //vdir.properties["authntlm"][0] = chkauth; 
    vdir.properties["enabledefaultdoc"][0] = true;
    vdir.properties["enabledirbrowsing"][0] = false;
    vdir.properties["defaultdoc"][0] = "default.aspx,index.aspx,index.asp"; //设置默认文档,多值情况下中间用逗号分割 
    vdir.properties["path"][0] = path;
    vdir.properties["authflags"][0] = iauth;
    //  
    // nt doesn't support this property  
    // nt格式不支持这特性  
    //   
    if (!iisundernt)
    {
     vdir.properties["aspenableparentpaths"][0] = true;
    }
    // 
    // set the changes  
    // 设置改变   
    //   
    vdir.commitchanges();

    return true;
   }
   catch (exception ex)
   {
    throw ex;
   }
  }
  /// <summary> 
  /// 獲取vdir支持的所有屬性 
  /// </summary> 
  /// <returns></returns> 
  public string getvdirpropertyname()
  {
   //system.directoryservices.directoryentry vdir; 
   const string constiiswebsiteroot = "iis://localhost/w3svc/1/root/ikaoo";
   directoryentry root = new directoryentry(constiiswebsiteroot);
   string sout = "";
   //下面的方法是得到所有属性名称的方法: 
   foreach (propertyvaluecollection pvc in root.properties)
   {
    //console.writeline(pvc.propertyname); 
    sout += pvc.propertyname + ":" + pvc.value.tostring() + "-----------";
   }
   return sout;
  }
  /// <summary> 
  /// 創建虛擬目錄 
  /// </summary> 
  /// <param name="sdirname">虛擬目錄程式名稱</param> 
  /// <param name="spath">實體路徑</param> 
  /// <param name="sdefaultdoc">黙認首頁,多個名稱用逗號分隔</param> 
  /// <param name="iauthflags">设置目录的安全性,0不允许匿名访问,1为允许,2基本身份验证,3允许匿名+基本身份验证,4整合windows驗證,5允许匿名+整合windows驗證...更多請查閱msdn</param> 
  /// <param name="swebsitenumber">win2k,2k3支持多個網站,本次操作哪個網站,黙認網站為1</param> 
  /// <returns></returns> 
  public bool createvdir(string sdirname, string spath, string sdefaultdoc, int iauthflags, string swebsitenumber)
  {
   try
   {
    string siiswebsiteroot = "iis://localhost/w3svc/" + swebsitenumber + "/root";
    directoryentry root = new directoryentry(siiswebsiteroot);
    foreach (system.directoryservices.directoryentry v in root.children)
    {
     if (v.name == sdirname)
     {
      // delete the specified virtual directory if it already exists 
      root.invoke("delete", new string[] { v.schemaclassname, sdirname });
      root.commitchanges();
     }
    }
    directoryentry tbentry = root.children.add(sdirname, root.schemaclassname);

    tbentry.properties["path"][0] = spath;
    tbentry.invoke("appcreate", true);
    //tbentry.properties["accessread"][0] = true; 
    //tbentry.properties["contentindexed"][0] = true; 
    tbentry.properties["defaultdoc"][0] = sdefaultdoc;
    tbentry.properties["appfriendlyname"][0] = sdirname;
    //tbentry.properties["accessscript"][0] = true; 
    //tbentry.properties["dontlog"][0] = true; 
    //tbentry.properties["authflags"][0] = 0; 
    tbentry.properties["authflags"][0] = iauthflags;
    tbentry.commitchanges();
    return true;
   }
   catch (exception ex)
   {
    throw ex;
   }
  }

 }

}
调用demo:
private void button1_click(object sender, eventargs e)
  {
   if (new iismanager().createwebsite("localhost", "vtest", "e:\\doc", false, 1, 1, "localhost"))
    lbinfo.text = "create vtest ok"; 
  }
  private void button2_click(object sender, eventargs e)
  {
   txtpn.text = new iismanager().getvdirpropertyname();
  }
  private void button3_click(object sender, eventargs e)
  {
   if (new iismanager().createvdir("ikaoo", "e:\\doc", "index.aspx,default.aspx", 1, "1"))
    lbinfo.text = "create ikaoo ok";
  }

同样的方式,也可以对网站对属性进行修改。

iis的站点属性(详细内容,请查阅iis帮助)

read only properties of w3svc/1/root:             // 只读属性

appisolated = 2             属性指出应用程序是在进程内、进程外还是在进程池中运行。值 0 表示应用程序在进程内运行,值 1 表示进程外,值 2 表示进程池。

apppackageid =           为事务提供 com+ 应用程序标识符 (id)。此 id 在由组件服务管理的所有事务中使用。

apppackagename =      为事务提供 com+ 应用程序名。

approot = /lm/w3svc/1/root 包含到应用程序根目录的配置数据库路径。

caption =              提供对象的一段简短文本描述(一行字符串)。

description =         提供对象的一段较长文本描述。

installdate =          表示安装对象的时间。缺少值并不表示对象没有安装。

name = w3svc/1/root     定义了用来识别对象的标签。创建子类时,可以将 name 属性改写为 key 属性。

status =         表示对象当前状态。各种可操作的和不可操作的状态都可以被定义。可操作的状态为“正常”、“已降级”和“预见故障”。“预见故障”表示一个组件可能运行正常但预计很快会出现故障。例如,启用 smart 的硬盘。还可指定不可操作的状态。这些状态为“错误”、“启动”、“停止”和“服务”。后者(即“服务”)可用于磁盘镜像过程、重新加载用户权限列表或其他管理作业。并不是所有这类作业都联机;所以,被管理的组件不是“正常”状态或处于任何其他状态。

read/write properties of w3svc/1/root:            // 可读/可写

accessexecute = false  值 true 表示不论文件类型是什么,文件或文件夹的内容都可以执行。

accessflags = 513 包含有用于配置文件访问权限的标志

accessnophysicaldir = false

accessnoremoteexecute = false 值 true 表示拒绝远程请求执行应用程序;如果将 accessexecute 属性设置为 true,只有来自 iis 服务器所在的相同计算机的请求才会成功。您不能将 accessnoremoteexecute 设置为 false 来启用远程请求,或将 accessexecute 设置为 false 来禁止本地请求。

accessnoremoteread = false      值 true 表示拒绝远程请求查看文件;如果将 accessread 属性设置为 true,只有来自 iis 服务器所在的相同计算机的请求才会成功。您不能将 accessnoremoteread 设置为 false 来启用远程请求,或将 accessread 设置为 false 来禁止本地请求。

accessnoremotescript = false    值 true 表示拒绝远程请求查看动态内容;如果将 accessscript 属性设置为 true,只有来自 iis 服务器所在的相同计算机的请求才会成功。您不能将 accessnoremotescript 设置为 false 来启用远程请求,或将 accessscript 设置为 false 来禁止本地请求。

accessnoremotewrite = false     值 true 表示拒绝远程请求创建或更改文件;如果将 accesswrite 属性设置为 true,只有来自 iis 服务器所在的相同计算机的请求才会成功。您不能将 accessnoremotewrite 设置为 false 来启用远程请求,或将 accesswrite 设置为 false 来禁止本地请求。

accessread = true              值 true 表示可通过 microsoft internet explorer 读取文件或文件夹的内容。

accessscript = true             值 true 表示如果是脚本文件或静态内容,则可以执行文件或文件夹的内容。值 false 只允许提供静态文件,如 html 文件。

accesssource = false           值 true 表示如果设置了读取或写入权限,则允许用户访问源代码。源代码包括 microsoft? active server pages (asp) 应用程序中的脚本。

accessssl = false        值 true 表示文件访问需要带有或不带有客户端证书的 ssl 文件权限处理。

accessssl128 = false         值 true 表示文件访问需要至少 128 位密钥、带有或不带有客户端证书的 ssl 文件权限处理。

accesssslflags = 0             默认值 0 表示未设置任何 ssl 权限。

accesssslmapcert = false  值 true 表示 ssl 文件权限处理将客户端证书映射到 microsoft windows? 操作系统的用户帐户上。要实现映射,必须将 accesssslnegotiatecert 属性设置成 true。

accesssslnegotiatecert = false  值 true 表示 ssl 文件访问处理从客户端请求证书。值 false 表示如果客户端没有证书,仍可继续访问。如果服务器请求证书但证书不可用(即使也将 accesssslrequirecert 设成 true),某些版本的 internet explorer 将关闭连接。

accesssslrequirecert = false     值 true 表示 ssl 文件访问处理从客户端请求证书。如果客户端没有提供证书,连接会关闭。当使用 accesssslrequirecert 时,必须将 accesssslnegotiatecert 设成 true。

accesswrite = false             值 true 表示允许用户将文件及其相关属性上载到服务器上已启用的目录中,或者更改可写文件的内容。只有使用支持 http 1.1 协议标准的 put 功能的浏览器,才能执行写入操作。

adminaclbin =                   由 microsoft? exchange server 使用

anonymouspasswordsync = true       指出 iis 是否应该为试图访问资源的匿名用户处理用户密码。下表列出了该属性行为的详细说明:如果将 anonymouspasswordsync 设置为 false,管理员必须手动设置匿名用户密码的 anonymoususerpass 属性;否则匿名访问将无法正常工作。 如果将 anonymouspasswordsync 设置为 true,将由 iis 设置匿名用户密码。 如果将 anonymouspasswordsync 设置为 true 并且配置数据库属性 allowanonymous 值为 false,则不允许任何用户登录到 ftp 服务器。

anonymoususername = iusr_computername    指定用来验证匿名用户的已注册的本地用户名。服务器将每个服务器操作与用户名和密码关联起来。

anonymoususerpass = xxxxxxxxxxxx      指定用来验证匿名用户的已注册的本地用户密码。服务器将每个服务器操作与用户名和密码关联起来。

appallowclientdebug = false       指定是否允许客户端调试。该属性与应用于服务器端调试的 appallowdebugging 无关。

appallowdebugging = false  指定是否允许在服务器上进行 asp 调试。该属性与应用于客户端调试的 appallowclientdebug 属性无关。

appfriendlyname = 默认应用程序     软件包或应用程序的用户好记名称

appooprecoverlimit = -1           进程外应用程序在出现故障后重新启动的最大次数。服务器不会响应超出该范围的组件请求。该属性不适用于进程内运行的应用程序或扩展。

apppoolid = asp.net v2.0  应用程序在其中路由的应用程序池

appwamclsid =                   为应用程序的 web 应用程序管理 (wam) 接口提供类 id

aspallowoutofproccomponents = true     在 iis 4.0 中,aspallowoutofproccomponents 属性指定是否允许 asp 脚本调用进程外组件,这些组件是在应用程序内启动的可执行程序。在 iis 5.0 中,该属性已过时,并且属性值将被忽略。但是,使用该属性的脚本仍然可以正常运行。

aspallowsessionstate = true       启用 asp 应用程序会话状态持续性。如果将该值设置为 true,那么服务器将为每个连接创建 session 对象,可访问会话状态,允许会话存储,出现 session_onstart 和 session_onend 事件,并且发送 aspsessionid cookie 到客户端。如果将该值设置为 false,那么不允许状态访问和存储,事件将不进行处理,并且也不发送 cookie。

aspappserviceflags = 0              包含在 iis 应用程序上启用 com+ 服务所必须要设置的标志

aspbufferinglimit = 4194304       设置 asp 缓冲区的最大大小。如果启动了响应缓冲,该属性将控制在进行刷新前 asp 页面可以向响应缓冲区写入的最大字节数

aspbufferingon = true        asp 应用程序的输出是否需要缓冲

aspcalclinenumber = true  asp 是否计算和存储已执行代码的行号,以便在错误报告中提供

aspcodepage = 0                 为应用程序指定默认的代码页

aspdisktemplatecachedirectory = %windir%\system32\inetsrv\asp comp     目录的名称,该目录是 asp 在存储器内的缓存溢出后,用来将已编译的 asp 模板存储到磁盘的目录

aspenableapplicationrestart = true     确定 asp 应用程序能否自动重新启动

aspenableasphtmlfallback = false      当由于请求队列已满而拒绝新的请求时,aspenableasphtmlfallback 属性控制 asp 的行为。将该属性设置为 true,将导致发送与请求的 .asp 文件名称类似的 .htm 文件(如果存在),而不是发送 .asp 文件。.htm 文件的命名约定是 .asp 文件名之后附加一个 _asp。例如,.asp 文件是 hello.asp,那么 .htm 文件应该是 hello_asp.htm。

aspenablechunkedencoding = true            指定是否为万维网发布服务(www 服务)启动 http 1.1 chunked 传输编码

aspenableparentpaths = false             页面是否允许当前目录的相对路径(使用 ..\ 表示法)。

aspenablesxs = false                  值 true 将启动 com+ 并排集合,该程序集允许 asp 应用程序指定要使用哪个版本的系统 dll 或传统 com 组件,例如 mdac、mfs、msvcrt、msxml 等等。

aspenabletracker = false            值 true 将启动 com+ 跟踪器,管理员或开发人员可用其来调试 asp 应用程序。

aspenabletypelibcache = true            是否在服务器上缓存类型库

asperrorstontlog = false         是否将 iis 脚本错误写入到 windows 事件日志中

aspexceptioncatchenable = true        页面是否捕获组件产生的异常。如果设置为 false (或者禁用),那么 microsoft 脚本调试程序工具将不捕捉所调试的组件发生的异常。

aspexecuteinmta = 0                 asp 能够在一个多线程单元 (mta) 中运行其全部线程。如果 com 组件主要是自由线程或双线程组件,则将 asp 线程作为 mta 运行可显著改善性能。默认情况下,aspexecuteinmta 属性设置为 0,这意味着 asp 不在 mta 中执行。在应用程序级别上将该属性设置为 1 可以使 asp 在 mta 中运行。

aspkeepsessionidsecure = 0              启用 aspkeepsessionidsecure 属性后,它可以确保将 sessionid 作为安全 cookie 发送(如果已在安全通道上分配的话)。

asplcid = 2048                         用程序指定默认的区域设置标识符 (lcid)。

asplogerrorrequests = true              控制 web 服务器是否将失败的客户请求写入到 windows 事件日志文件中

aspmaxdisktemplatecachefiles = 2000      指定存储已编译 asp 模板的最大数量。存储已编译模板的目录由 aspdisktemplatecachedirectory 属性配置。

aspmaxrequestentityallowed = 204800      指定一个 asp 请求的实体正文中允许的最多字节数。

asppartitionid =                  com+ 分区用于将 web 应用程序隔离到其各自的 com+ 分区。com+ 分区保存不同的自定义 com 组件的版本。将 asppartitionid 属性设置为 com+ 分区的全局唯一标识符 (guid)。同时,设置 aspappserviceflags 配置数据库属性的 aspusepartition 标志。在应用程序级别设置这两个属性

aspprocessorthreadmax = 25             指定 iis 可创建的每个处理器的最大工作线程数

aspqueueconnectiontesttime = 3              iis 将所有的 asp 请求放置到队列中。如果请求在队列中等待的时间比 aspqueueconnectiontesttime 属性指定的时间(以秒为单位)长,则 asp 将在执行请求前检查确定客户端是否仍是连接的。如果客户端已断开连接,则不处理该请求并且从队列中删除该请求。

aspqueuetimeout = -1                允许 asp 脚本请求在队列中等待的时间(以秒为单位)。无穷大表示为 -1。

asprequestqueuemax = 3000             允许进入队列的并发 asp 请求的最大数目。在队列占满时,任何试图请求 asp 文件的客户端浏览器都将收到 http 500“服务器太忙”的错误。

asprunonendanonymously = true            指定了 sessiononend 和 applicationonend 全局 asp 函数是否应该作为匿名用户运行

aspscriptenginecachemax = 250        页面将在内存中保持缓存的脚本引擎的最大数目

aspscripterrormessage = 处理 url 时服务器出错。请与系统管理员联系。    特殊调试错误没有被发送到客户端时(如果将 aspscripterrorsenttobrowser 设置成 false)将发送给浏览器的错误消息

aspscripterrorsenttobrowser = true  web 服务器是否将调试细节(文件名、错误、行号、描述)写到客户端浏览器,并且记录到 windows 事件日志中

aspscriptfilecachesize = 500             要缓存的预编译脚本文件数。如果设置为 0,则不缓存任何脚本文件

aspscriptlanguage = vbscript            运行在 web 服务器上的所有 asp 应用程序的默认脚本语言

aspscripttimeout = 90                aspscripttimeout 属性指定了在终止脚本和将事件写入 windows 事件日志之前,asp 页面允许的脚本运行时间的默认值(以秒为单位)。

aspsessionmax = -1                    iis 允许的最大并发会话数。当达到该限制时,如果客户端试图与 iis 建立新连接,则客户端将接收到错误信息(http 500“服务器太忙”)。无穷大表示为 -1。

aspsessiontimeout = 20                     完成最后的与 session 对象相关的请求后,保留该对象的时间(以分钟为单位)。

aspsxsname =             启动并行 (sxs) 程序集。并行 (sxs) 程序集允许 asp 应用程序指定要使用哪个版本的系统 dll 或传统 com 组件,例如 mdac、mfs、msvcrt、msxml 等。

asptrackthreadingmodel = false        iis 是否检查应用程序创建的任意组件的线程模块。

aspusepartition = false        值 true 将启动 com+ 分区,可用其将 web 应用程序隔离到各自的 com+ 分区。com+ 分区可拥有不同的自定义 com 组件的版本。如果设置该标志,请同时设置 asppartitionid 配置数据库属性。

authadvnotifydisable = true              禁用密码到期预先通知

authanonymous = true               指定匿名身份验证作为可能的 windows 验证方案之一,返回给客户端作为有效验证方案。

authbasic = false                 指定基本身份验证作为可能的 windows 验证方案之一,返回给客户端作为有效验证方案。

authchangedisable = true           禁止更改密码

authchangeunsecure = false              允许在不安全端口更改密码

authchangeurl = /iisadmpwd/achg.asp      用户输入新密码时被调用的 url

authexpiredunsecureurl = /iisadmpwd/aexp3.asp     用户密码到期时调用的 url

authexpiredurl = /iisadmpwd/aexp.asp      用户密码到期时调用的 url。将以安全的 (https) 方式调用它。

authflags = 5                      作为有效方案返回给客户端的 windows 验证方案的设置

authmd5 = false                        指定摘要式身份验证和高级摘要式身份验证作为可能的 windows 验证方案之一,返回给客户端作为有效验证方案。

authnotifypwdexpunsecureurl = /iisadmpwd/anot3.asp  包含一个特定的 url:如果用户的密码在 passwordexpireprenotifydays 中指定的天数前到期,则调用该 url。

authnotifypwdexpurl = /iisadmpwd/anot.asp   包含一个特定的 url:如果用户的密码在 passwordexpireprenotifydays 中指定的天数前到期,则调用该 url。将以安全的 (https) 方式调用它。

authntlm = true                      指定集成 windows 身份验证(也称作质询/响应或 ntlm 验证)作为可能的 windows 验证方案之一,返回给客户端作为有效验证方案。

authpassport = false                   true 的值表示启用了 microsoft? .net passport 身份验证

authpersistence = 64                   指定了使用 ntlm 验证跨越连接上的请求时的验证持久性

authpersistsinglerequest = true         将该标志设置成 true 指定验证仅对一个连接上的单个请求持久。iis 在每个请求的末尾重设验证,并且在会话的下一个请求上强制执行重验证。

azenable = false                  用于虚拟目录、应用程序,或配置数据库中项相应的 url 的 url 授权。

azimpersonationlevel = 0            用于应用程序的模拟行为,该模拟行为允许配置 web 应用程序模拟客户端用户、iis 工作进程,或工作进程的 iuser_* 帐户。

azscopename =                         将虚拟目录、应用程序或 url 与作用域相关联。如果没有指定作用域或指定了空子符串,则使用 iis 6.0 url 授权的默认作用域。

azstorename =                           授权管理器策略存储与虚拟目录、应用程序或 url 相关联。

cachecontrolcustom =                指定了自定义 http 1.1 缓存控制指令。

cachecontrolmaxage = 0                   指定了 http 1.1 缓存控制最大时间值。

cachecontrolnocache = false             保护缓存内容的 http 1.1 指令

cacheisapi = true                     在第一次使用 isapi 扩展后是否在内存中进行缓存。

caption =                            提供对象的一段简短文本描述(一行字符串)。

cgitimeout = 300               指定 cgi 应用程序超时(以秒为单位)。

contentindexed = true                指定安装的目录索引程序是否应该检索该目录树下的内容。

createcgiwithnewconsole = false            指示 cgi 应用程序是否在自己的控制台上运行。

createprocessasuser = true        是在系统环境中创建 cgi 进程还是在请求用户环境中创建 cgi 进程。

defaultdoc = index.aspx,default.aspx   包含一个或多个默认文档的文件名,如果在客户端的请求中不包含文件名,将把默认文档的文件名返回给客户端。

defaultdocfooter =                     附加到返回到客户端的 html 文件的自定义页脚(页脚并不附加到 asp 文件)。

defaultlogondomain =                服务器用来对用户进行身份验证的默认域(在 userisolationmode = 2 的 web 宿主方案中)。

description =                       提供对象的一段较长文本描述。

dirbrowseflags = 1073741886            可以提供多少目录和文件信息(如果启用浏览)以及目录中是否包含默认页的标记。

dirbrowseshowdate = true        设置为 true 时,浏览目录时将显示日期信息。

dirbrowseshowextension = true        设置为 true 时,浏览目录时将显示文件扩展名。

dirbrowseshowlongdate = true        设置为 true 时,显示目录时将在扩展格式中显示日期信息。

dirbrowseshowsize = true         设置为 true 时,浏览目录时将显示文件大小信息。

dirbrowseshowtime = true        设置为 true 时,显示目录时将显示文件时间信息。

disablestaticfilecache = false             目录的静态文件缓存

dodynamiccompression = false         与 hcdodynamiccompression 属性相同。

dontlog = false                         是否将客户端的请求写入日志文件。

dostaticcompression = false              与 hcdostaticcompression 属性相同。

enabledefaultdoc = true                    设置为 true 时,浏览目录时系统会加载该目录的默认文档(由 de, faultdoc 属性指定)。

enabledirbrowsing = false           设置为 true 时,将启用目录浏览。

enabledocfooter = false                    启用或禁用由 defaultdocfooter 属性指定的自定义页脚。

enablereversedns = false            启用或禁用万维网发布服务(www 服务)的反向域名服务器 (dns) 查找。

frontpageweb = true                  服务器实例是否由 microsoft? frontpage? 处理。

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对移动技术网的支持。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网