Bạn không cần phải làm tất cả những việc này.
Chỉ sử dụng iisreset /stop
sau đó iisreset /start
khi bạn hoàn tất việc triển khai của mình sẽ hoạt động.
Nó khá nhanh và đảm bảo khởi động lại an toàn IIS.
Chỉnh sửa:
Bạn có thể thực hiện cấu hình đầy đủ các trang web và thư mục ảo bằng WiX.
Wix mẫu cho việc tạo ra một trang web trong IIS (sẽ không làm việc như là):
<!-- Create the web site in IIS -->
<Component Id="WebSiteComponent" Guid="<INSERT-GUID>" KeyPath="yes">
<iis:WebAppPool Id="WebSiteAppPool" Name="WebSiteAppPool" RecycleMinutes="1740" QueueLimit="4000" IdleTimeout="20" MaxWorkerProcesses="1" Identity="networkService" />
<!-- web site -->
<iis:WebSite Id="WebSiteIIS" AutoStart="yes" ConfigureIfExists="yes" Description="WebSite" SiteId="59" StartOnInstall="yes" Directory="SiteFolder">
<!-- Host headers to enable web site to be hosted on port 80 -->
<iis:WebAddress Id="HostHeader" Header="myWebSite" IP="*" Port="80" Secure="no" />
<iis:WebAddress Id="SecureHostHeader" Header="myWebSite" IP="*" Port="443" Secure="yes" />
<!-- download web site web application -->
<iis:WebApplication Id="WebSiteWebApplication" AllowSessions="yes" SessionTimeout="20" Buffer="yes" ParentPaths="no" ClientDebugging="no" Name="Default Application" WebAppPool="WebSiteAppPool" DefaultScript="VBScript" ScriptTimeout="90" ServerDebugging="no" />
<iis:WebDirProperties Id="WebSiteProperties" Read="yes" LogVisits="yes" Index="yes" Execute="no" Write="no" AnonymousAccess="yes" AccessSSL="no" Script="yes" AspDetailedError="yes" />
<!-- web service virtual directory -->
<iis:WebVirtualDir Id="WebServiceVDir" Alias="Service" Directory="WebServiceFolder">
<iis:WebDirProperties Id="WebServiceVDirProperties" Read="yes" Write="yes" LogVisits="yes" Index="yes" BasicAuthentication="yes" AnonymousAccess="no" AccessSSL="yes" AccessSSL128="yes" Execute="no" Script="yes" AspDetailedError="yes" />
<iis:WebApplication Id="WebServiceWebApplication" AllowSessions="yes" Buffer="yes" ClientDebugging="no" ServerDebugging="no" WebAppPool="WebSiteAppPool" Name="Default Application" SessionTimeout="20" ParentPaths="no" DefaultScript="VBScript" ScriptTimeout="90" />
</iis:WebVirtualDir>
</iis:WebSite>
</Component>
Đối với một ví dụ khác xem tại đây:
http://strangelights.com/blog/archive/2004/10/08/179.aspx
Nếu bạn chỉ cần tái chế các dịch vụ: 'iisreset/restart'. Và lưu ý trên Win2k8/Vista và sau này điều này cần phải từ một lệnh nâng lên/dấu nhắc PowerShell. – Richard
Cá nhân, tôi sẽ triển khai các tệp bằng trình cài đặt WiX sẽ sắp xếp tất cả những thứ này cho tôi và cho phép triển khai nhanh đến máy chủ mới nếu tôi cần. – fletcher
@Richard: bất kỳ lệnh mẫu/PowerShell nào? @fletcher: bất kỳ mẫu nào của WIX? Tôi sử dụng kịch bản Msbuild để triển khai. – Kiquenet