用指令来构建IIS7

工作上要部署iis7+net4.0环境,发现30多台机子都没有用装有IIS7镜像来安装,都必须自己手动。

作为程序猿,真要一台台装的话,就真对不起自己的职业。于是想到用bat来执行任务,找到了安装IIS的cmd指令:

 dism /Online /Enable-Feature /FeatureName:IIS-ApplicationDevelopment /FeatureName:IIS-ASP /FeatureName:IIS-ASPNET /FeatureName:IIS-BasicAuthentication /FeatureName:IIS-CGI /FeatureName:IIS-ClientCertificateMappingAuthentication /FeatureName:IIS-CommonHttpFeatures /FeatureName:IIS-CustomLogging /FeatureName:IIS-DefaultDocument /FeatureName:IIS-DigestAuthentication /FeatureName:IIS-DirectoryBrowsing /FeatureName:IIS-FTPExtensibility /FeatureName:IIS-FTPServer /FeatureName:IIS-FTPSvc /FeatureName:IIS-HealthAndDiagnostics /FeatureName:IIS-HostableWebCore /FeatureName:IIS-HttpCompressionDynamic /FeatureName:IIS-HttpCompressionStatic /FeatureName:IIS-HttpErrors /FeatureName:IIS-HttpLogging /FeatureName:IIS-HttpRedirect /FeatureName:IIS-HttpTracing /FeatureName:IIS-IIS6ManagementCompatibility /FeatureName:IIS-IISCertificateMappingAuthentication /FeatureName:IIS-IPSecurity /FeatureName:IIS-ISAPIExtensions /FeatureName:IIS-ISAPIFilter /FeatureName:IIS-LegacyScripts /FeatureName:IIS-LegacySnapIn /FeatureName:IIS-LoggingLibraries /FeatureName:IIS-ManagementConsole /FeatureName:IIS-ManagementScriptingTools /FeatureName:IIS-ManagementService /FeatureName:IIS-Metabase /FeatureName:IIS-NetFxExtensibility /FeatureName:IIS-ODBCLogging /FeatureName:IIS-Performance /FeatureName:IIS-RequestFiltering /FeatureName:IIS-RequestMonitor /FeatureName:IIS-Security /FeatureName:IIS-ServerSideIncludes /FeatureName:IIS-StaticContent /FeatureName:IIS-URLAuthorization /FeatureName:IIS-WebDAV /FeatureName:IIS-WebServer /FeatureName:IIS-WebServerManagementTools /FeatureName:IIS-WebServerRole /FeatureName:IIS-WindowsAuthentication /FeatureName:IIS-WMICompatibility /FeatureName:WAS-ConfigurationAPI /FeatureName:WAS-NetFxEnvironment /FeatureName:WAS-ProcessModel /FeatureName:WAS-WindowsActivationService
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

dism后面跟的指令必须是一行的,最后一个指令是向iis注册.net,因为很多先安装.net4在安装iis就会无法加载4.0的一些环境需要重新注册。上面的安装指令是全部安装iis7的功能,如果想去掉其中几个功能可以自己去删掉一些。

建完环境之后要建站了,这个需要appcmd.exe。这个exe的位置是C:\Windows\System32\inetsrv下,

建站指令如下

C:\Windows\System32\inetsrv\appcmd add site /name:"XXX" /id:5 /bindings:http://*:80 /physicalPath:"XXX/XXX"  bingdings项是绑定80端口,最后一个物理地址,应用程序池是为默认的.如果要自己建程序池的指令为:

appcmd add apppool /name:appPoolName /managedRuntimeVersion:"v4.0" /managedPipelineMode:"Integrated"  这个就不多解释了,大家都能看得懂。

以上只为方便建环境,如果有朋友更好的办法欢迎留言。

有朋友想要详细的关于IIS的cmd指令请查阅下面链接http://www.cnblogs.com/CHNI/p/3369886.html

上一篇:css清除默认样式,stylus学习


下一篇:html初识form表单