Install IIS from C# code

前端 未结 1 1911
抹茶落季
抹茶落季 2020-12-31 21:13

Is any way that I can install IIS from C# code?
I need to create a deploy installer for my application but I need that IIS to be installed in the machine so I want to ve

相关标签:
1条回答
  • 2020-12-31 21:16

    Here in the method I used: I call the followind command line applications for the different IIS versions.
    For IIS 5.1 (Windows XP) and IIS 6 (Windows Server 2003):

    Sysocmgr.exe /i:sysoc.inf /u:IIS_on.txt
    

    Content of IIS_on.txt

    [Components]
    iis_common = ON
    iis_www = ON
    iis_www_vdir_scripts = ON
    iis_inetmgr = ON
    fp_extensions = ON
    iis_ftp = ON 
    

    For IIS 7 (Windows Vista) and 7.5 (Windows 7):

    start /w pkgmgr /l:log.etw /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-Security;IIS-BasicAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI
    

    Here are some links about this subject:
    http://blogs.msdn.com/b/rakkimk/archive/2007/06/22/how-to-perform-an-unattended-install-uninstall-of-iis-5-0-5-1-6-0.aspx
    http://support.microsoft.com/kb/309506
    http://technet.microsoft.com/pt-br/library/cc731911(WS.10).aspx
    http://learn.iis.net/page.aspx/132/install-iis-7-from-the-command-line/
    http://learn.iis.net/page.aspx/479/iis-70-features-and-vista-editions/
    http://learn.iis.net/page.aspx/135/discover-installed-components/

    0 讨论(0)
提交回复
热议问题