¡¾×ª¡¿C#´´½¨ÍøÕ¾·½·¨£¨Ò»£©
1¡¢ÒýÓõĿռ䣺
using System.DirectoryServices;
using System.ServiceProcess;
2¡¢µ÷ÓÃ
private void button1_Click(object sender, EventArgs e)
{
String webSiteName = "ĬÈÏÍøÕ¾";
String pathToRoot = @"C:\Inetpub\wwwroot";
CreateWebSite(webSiteName,"80", pathToRoot);
}
3¡¢·½·¨
private void CreateWebSite(string webSiteName, string webSitePort, string pathToRoot)
{
//Õ¾µãÃû³ÆºÍÎïÀí·¾¶
DirectoryEntry root = new DirectoryEntry("IIS://localhost/W3SVC");// Find unused ID value for new web site
int siteID = 1;
//µÃµ½ÏÖÓеÄÕ¾µã±êʶ
foreach (DirectoryEntry entry in root.Children)
{
if (entry.SchemaClassName == "IIsWebServer")
{
int ID = Convert.ToInt32(entry.Name);
if (ID >= siteID)
{
siteID = ID + 1;
}
}
}
//ÀûÓÃÅäÖÃÎļþµÄ×ö·¨´´½¨Õ¾µã£¬ÐèÒªÏÈÍ£Ö¹ÔÀ´µÄ·þÎñ£¬ÒÔ±ãÄܹ»Ë³ÀûдÈëÊý¾Ý
label1.Text = "ÕýÔÚÍ£Ö¹·þÎñ……";
Application.DoEvents();
System.ServiceProcess.ServiceController mobServiceController3 = new System.ServiceProcess.ServiceController("IISAdmin");
foreach (System.ServiceProcess.ServiceController dependentService in mobServiceController3.DependentServices)
{
switch (dependentService.Status)
{
case ServiceControllerStatus.Stopped:
break;
case ServiceControllerStatus.StopPending:
dependentService.WaitForStatus(ServiceControllerStatus.Stopped);
break;
default:
dependentService.Stop();
dependentService.WaitForStatus(ServiceController
Ïà¹ØÎĵµ£º
×î½ü¿Í»§Ë÷Òª²úÆ·µÄ¶þ´Î¿ª·¢Àà¿âÎĵµ,ÓÉÓÚ¿ª·¢¹ý³ÌÖв¢Ã»Óп¼Âǹý´ËÀàÎĵµ,¶øÇÒÏîÄ¿¹æ·¶±È½Ï£¬³ÖÐøʱ¼ä±È½Ï³¤£¬¾ÊÖÈ˱Ƚ϶࣬»¹ÕæÊÇÂé·³,Èç¹ûÈ˹¤ÖÆ×÷ÎĵµÐèÒªÊÇÒ»¸ö±È½Ï´óµÄ¹¤³Ì.»¹ºÃÓÐÕâ¸öÎĵµÉú³É¹¤¾ß,Äܹ»¸ù¾ÝÏîÄ¿Éú³ÉÎĵµ,¶øÇÒ¸ñʽ¿´ÆðÀ´È·ÊµºÜרҵ.
Sa ......
ÊÖ»úÉÏÍøÔ½À´Ô½ÆÕ¼°£¬ÊÖ»úÖÖÀàÔ½À´Ô½¶à£¬Òª¿ª·¢Ò»¸ö¹©ÊÖ»ú·ÃÎÊÍøÕ¾²¢¼æÈÝËùÓв»Í¬ÀàÐ͵ÄÊÖ»úºÍä¯ÀÀÆ÷ÊǺܲ»ÈÝÒ׵ģ¬±±¾©Ê¦·¶´óѧ×ÔÏ°ÊÒ²éѯƽ̨µÄÊÖ»ú°æ×î³õÊÇÖ±½ÓÓÃASP.NETʵÏֵģ¬Ö»ÊÇÓÃCSS¶¨Òå³ÉÁËÊʺÏÊÖ»úÆÁÄ»µÄÒ³Ã棬ËäȻͬѧÃÇ·ÃÎÊ»ù±¾Ã»ÓÐÎÊÌ⣬µ«ÊÇҲż¶û»áÓГ²»ÄÜÑ¡ÔñÏÂÀ²Ëµ¥”¡¢“°´Å¥button²»Ä ......
Õâ¸öÀý×ÓÒª°Ñbookstore.xmlÎļþÔö¼ÓÒ»Ìõbook¼Ç¼
1 bookstore.xml
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="love" ISBN="1234123">
<title>who am i </title>
<author>who</author>
  ......
Ìá¸ßC#±à³ÌˮƽµÄ50¸öÒªµã
1.×ÜÊÇÓÃÊôÐÔ (Property) À´´úÌæ¿É·ÃÎʵÄÊý¾Ý³ÉÔ±
2.ÔÚ readonly ºÍ const Ö®¼ä£¬ÓÅÏÈʹÓà readonly
3.ÔÚ as ºÍ Ç¿ÖÆÀàÐÍת»»Ö®¼ä£¬ÓÅÏÈʹÓà as ²Ù×÷·û
4.ʹÓÃÌõ¼þÊôÐÔ (Conditional Attributes ......
http://blog.csdn.net/carl2380/archive/2009/11/18/4826973.aspx
¼ò½é:
±¾ÎÄ×ÅÖؽ²ÊöÁËÈç¹ûÓÃWM_COPYDATAÏûÏ¢À´ÊµÏÖÁ½¸ö½ø³ÌÖ®¼ä´«µÝÊý¾Ý.
½ø³ÌÖ®¼äͨѶµÄ¼¸ÖÖ·½·¨:
ÔÚWindows³ÌÐòÖУ¬¸÷¸ö½ø³ÌÖ®¼ä³£³£ÐèÒª½»»»Êý¾Ý£¬½øÐÐÊý¾ÝͨѶ¡£³£Óõķ½·¨ÓÐ
ʹÓÃÄÚ´æÓ³ÉäÎļþ
ͨ¹ý¹²ÏíÄÚ´æDLL¹²ÏíÄÚ´æ
ʹ ......