Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¡¾×ª¡¿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


Ïà¹ØÎĵµ£º

ÓÃC#Éú³ÉWAPÒ³Ãæ½éÉÜ

ÊÖ»úÉÏÍøÔ½À´Ô½ÆÕ¼°£¬ÊÖ»úÖÖÀàÔ½À´Ô½¶à£¬Òª¿ª·¢Ò»¸ö¹©ÊÖ»ú·ÃÎÊÍøÕ¾²¢¼æÈÝËùÓв»Í¬ÀàÐ͵ÄÊÖ»úºÍä¯ÀÀÆ÷ÊǺܲ»ÈÝÒ׵쬱±¾©Ê¦·¶´óѧ×ÔϰÊÒ²éѯƽ̨µÄÊÖ»ú°æ×î³õÊÇÖ±½ÓÓÃASP.NETʵÏֵģ¬Ö»ÊÇÓÃCSS¶¨Òå³ÉÁËÊʺÏÊÖ»úÆÁÄ»µÄÒ³Ãæ£¬ËäȻͬѧÃÇ·ÃÎÊ»ù±¾Ã»ÓÐÎÊÌ⣬µ«ÊÇҲż¶û»áÓГ²»ÄÜÑ¡ÔñÏÂÀ­²Ëµ¥”¡¢“°´Å¥button²»Ä ......

C#ÐÞ¸ÄXMLµÄ¼òµ¥Àý×Ó

½ÓÉÏһƪ¡¶C#дXMLµÄ¼òµ¥Àý×Ó¡·
Õâ¸öÀý×ÓÒªÐÞ¸ÄXMLÎļþÖнáµãµÄÊôÐԺͺÍÔªËØµÄÎı¾
1 Ô­xmlÎļþ bookstore.xml
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
  <book genre="love" ISBN="1234123">
    <title>who am i </title>
    &l ......

C#ÏÔʾXMLÔªËØÄÚÈݵļòµ¥Àý×Ó

½ÓÉÏһƪ
ÏÔʾËùÓнáµãµÄÄÚÈÝ
1 Ô­xmlÎļþ bookstore.xml
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
  <book ISBN="1234123">
    <title>who am i </title>
    <author>who</author>
    <price> ......

C#ÀûÓÃwebrequest¼ÆËã´ýÏÂÔØµÄÎļþ´óС

C#ÀûÓÃwebrequest¼ÆËã´ýÏÂÔØµÄÎļþ´óС
string URL = textBox1.Text;
string filetype = URL.Substring(URL.LastIndexOf(".") + 1, (URL.Length - URL.LastIndexOf(".") - 1));
filetypevalue.Text = filetype.ToUpper();
string filename = URL.Substring(URL.LastIn ......

GDI+ÈëÃÅ(C#¸ßËÙ´¦Àí°æ±¾)

Ê×ÏȸÐлCSDNµÄÅóÓÑlaviewpbtΪÎÒ¸øÎҵĽ¨Òé¡£
laviewpbtÌá³öʹÓÃgetpixel´¦ÀíËÙ¶ÈÌ«Âý£¬Éϲ»Á˵µ´Î¡£
ÕâÀïÎÒÔÙ¸ø´ó¼ÒдÁ½ÖÖ´¦ÀíËٶȸü¿ìµÄͼÐδ¦Àí·½Ê½¡£
ÏÂÃæÊǸöÄÚ´æ²Ù×÷»Ò¶ÈµÄ³ÌÐò£º
bmp = new Bitmap(Application.StartupPath + "\\1.jpg");
            ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ