gpt4 book ai didi

c# - 从 C# 代码安装 IIS

转载 作者:太空狗 更新时间:2023-10-29 21:25:17 25 4
gpt4 key购买 nike

有什么方法可以从 C# 代码安装 IIS?
我需要为我的应用程序创建一个部署安装程序,但我需要在机器中安装 IIS,所以我想验证是否使用 C# 代码安装了 IIS,如果没有安装它。
安装程序必须适用于所有版本的 IIS。

提前致谢。
保罗

最佳答案

这里我用的方法:我为不同的 IIS 版本调用 followind 命令行应用程序。
对于 IIS 5.1 (Windows XP) 和 IIS 6 (Windows Server 2003):

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

IIS_on.txt 的内容

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

对于 IIS 7 (Windows Vista) 和 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

这里有一些关于这个主题的链接:
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/

关于c# - 从 C# 代码安装 IIS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3245199/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com