开发者

Install IIS from C# code

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开发者_Python百科 to verify if IIS is installed using C# code and install it if it's not.

The installer must work with all versions of IIS.

Thanks in advance.

Paulo


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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜