Website installation and packaging software environment detection and installation [2]

Source: Internet
Author: User

This section focuses on installation!

1. Operating System

This should be no longer needed and cannot be run without a system!

2. IIS Installation

This is the key point. Last introduction!

3. Framework Installation

This is no longer needed. The tool will be checked during installation. If it is not installed, it cannot be opened!

4. RAR Installation

You can call the RAR Installation File to start the installation.

The code is simple: Process. Start ("RAR Installation Software path ");

 

 

The following describes how to install IIS automatically.

 

The Automatic Installation of IIS is also very simple. let's first talk about the principle and then the next step:

Principle: Install the tool that comes with sysocmgr.exe. The main parameter is: "/I: sysoc. inf/u: \" here is the iis.txt file path \""

The parameter here does not have the path of the iis Installation File. Where is the path specified? A: The Path is specified in the registry.

Registry path: Machine \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Setup

There are two keys: SourcePath and ServicePackSourcePath.

So, before running sysocmgr.exe,

First, configure the iis.txt file,

2. Modify the Registry path first.

3. Run sysocmgr.exe

4. Modify the Registry

 

The main steps are as follows:

1. Create a txt file and write the components to be installed in IIS in the following format:

[Components]
Iis_common = ON
Iis_www = ON
Iis_asp = ON
Iis_inetmgr = ON
Aspnet = ON

------------------Save it as iis.txt. For other component names, see iis6.0 help documentation!

Steps 2, 3, and 4 are provided directly with the code below:

 

IIS Installation


/// <Summary>
/// Install IIS
/// </Summary>
/// <Param name = "installPath"> iis386 folder path </param>
/// <Param name = "iisTxt"> stores the text path of the installation component. </param>
/// <Param name = "errMsg"> returned error message </param>
/// <Returns> </returns>
Public static bool Install (string installPath, string iisTxt, out string errMsg)
{
ErrMsg = "";
RegistryKey key = Registry. LocalMachine. OpenSubKey (@ "SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Setup", true );
If (key = null) {return false ;}
String sourcePath = Convert. ToString (key. GetValue ("SourcePath "));
String servicePackSourcePath = Convert. ToString (key. GetValue ("ServicePackSourcePath "));

Try
{

Key. SetValue ("ServicePackSourcePath", installPath );
Key. SetValue ("SourcePath", installPath );

Process rarPro = new Process ();
RarPro. StartInfo. FileName = "Sysocmgr.exe ";
RarPro. StartInfo. Arguments = string. Format ("/I: sysoc. inf/u: \" {0} \ "", iisTxt );
RarPro. StartInfo. UseShellExecute = false;
RarPro. StartInfo. CreateNoWindow = false;
RarPro. StartInfo. WindowStyle = ProcessWindowStyle. Hidden;
RarPro. Start (); // Start
RarPro. WaitForExit (); // wait for exiting
RarPro. Dispose ();
Return true;
}
Catch (Exception err) {errMsg = err. Message ;}
Finally
{
Key. SetValue ("ServicePackSourcePath", servicePackSourcePath );
Key. SetValue ("SourcePath", sourcePath );
}
Return false;
}

 

After finishing, close the job!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.