When we download the open source webProgramSome programs cannot run in the virtual directory. to run the program, we need to create a website, set a Host header, and then modify the host file. it is troublesome to find the file with a deep directory structure, so write down this tool.
The main technology used by gadgets is to operate IIS. There are already manyCodeIn addition, the program will automatically modify your host file. When binding an IP address, the format is IP: Port: domain.
The difficulty of creating a program is as follows: how to find the key corresponding to properties, which has no benefit for the Design Pattern of. Ms created under children.
String Entpath = String. Format ( " IIS: // {0}/w3svc " , Hostname );
Directoryentry rootentry = Getdirectoryentry (entpath ); // Obtain the IIS path
String Newsitenum = Getnewwebsiteid (); // Get new website ID
Directoryentry newsiteentry = Rootentry. Children. Add (newsitenum, " Iiswebserver " ); // Add site
Newsiteentry. commitchanges (); // Save changes to the region (changes to the site here)
Newsiteentry. properties [ " Serverbindings " ]. Value = Domainip;
Newsiteentry. properties [ " Servercomment " ]. Value = Commentofwebsite;
Newsiteentry. properties [ " Accessread " ] [ 0 ] = True ;
Newsiteentry. properties [ " Accessexecute " ] [ 0 ] = True ;
Newsiteentry. properties [ " Apppoolid " ] [ 0 ] = " Defaultapppool " ;
// Newsiteentry. properties ["accesswrite"] [0] = true;
Newsiteentry. commitchanges ();
Directoryentry vdentry = Newsiteentry. Children. Add ( " Root " , " Iiswebvirtualdir " );
Vdentry. commitchanges ();
Vdentry. properties [ " Path " ]. Value = Webpath;
Vdentry. commitchanges ();
Vdentry. Invoke ( " Appcreate " , 1 );
The entire program is relatively simple and interested in downloading code.