日期:2013-06-17  浏览次数:20508 次

 这是当年赶工的网站用到的东东, 结果快做完了警察叔叔来个网站要备案,朋友不干了,我也停工了,

翻出来共享了~

据说,控制IIS和别的MS的垃圾(MS的FTP, 用户管理.....)可以用ADSI和WMI(WIN2k3的才好),

参考了网友们的资料,有版权问题麻烦EMAIL一下

原来是按三层写的代码没有整理, 权当笔记,省点稿纸, 大家看个大概, 详细的MSDN都有!

三个文件:

////////FileName: hostservice.cs

//////////////////////////////////////////////////////////////////////////////////////////////////

using System;
using System.Data;

using Wooyea.WebSite.Modules.Hosts.DataAccess;
using Wooyea.WebSite.Modules.Hosts.Configuration;

namespace Wooyea.WebSite.Modules.Hosts.Business
{
 /// <summary>
 /// Summary description for HostService.
 /// </summary>
 public class HostService
 {
  #region Private fields

  private ModuleSettings settings;

  private int  id;
  private string name;
  private string description;
  private decimal price;   // the field in SQL server is the type of smallmoney
  private string ip;
  private int  port;
  private string rootPath;
  private int  maxBandwidth;
  private int  maxConnections;
  private int  cpuLimit;
  private byte serverSize;
  private byte appIsolated;
  #endregion

  #region Properties
  
  public int ID
  {
   get {return id;}
   set {id = value;}
  }

  public string Name
  {
   get {return name;}
   set {name = value;}
  }

  public string Description
  {
   get {return description;}
   set {description = value;}
  }

  public decimal Price
  {
   get {return price;}
   set {price = value;}
  }

  public string IP
  {
   get {return ip;}
   set {ip = value;}
  }

  public int Port
  {
   get {return port;}
   set {port = value;}
  }

  public string RootPath
  {
   get {return rootPath;}
   set {rootPath = value;}
  }
  
  public int MaxBandwidth
  {
   get {return maxBandwidth;}
   set {maxBandwidth = value;}
  }

  public int CpuLimit
  {
   get {return cpuLimit;}
   set {cpuLimit = value;}
  }

  public byte ServerSize
  {
   get {return serverSize;}
   set {serverSize = value;}
  }

  #endregion

  public HostService()
  {
   Configuration.ModuleConfig config = new ModuleConfig();
   settings = config.GetSettings();
  }

  public HostService(string name, string description, decimal price, string ip, string rootPath) : this()
  {
   this.name   = name;
   this.description = description;
   this.price   = price;
   this.ip    = ip;
   this.rootPath  = rootPath;

  }

  public HostService(int id) : this()
  {
   this.id = id;
&nb