{"id":2944,"date":"2010-06-25T11:13:24","date_gmt":"2010-06-25T11:13:24","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/2010\/06\/25\/a-practical-example-of-using-web-application-deployment-package-with-iis7\/"},"modified":"2010-06-25T11:13:24","modified_gmt":"2010-06-25T11:13:24","slug":"a-practical-example-of-using-web-application-deployment-package-with-iis7","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/a-practical-example-of-using-web-application-deployment-package-with-iis7\/","title":{"rendered":"A practical example of using web application deployment package with IIS7"},"content":{"rendered":"<p>When a zip package is built from VS2010 web application UI (via Build Deployment Package command), or through command line (msbuild myproject.csproj \/t:package), a few files are generated in the destination folder. Here&rsquo;s some brief description:<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"2\" width=\"569\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"177\"><strong>File Name<\/strong><\/td>\n<td valign=\"top\" width=\"390\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"177\">myApp.deploy-readme.txt<\/td>\n<td valign=\"top\" width=\"390\">Read me file of how to use myApp.deploy.cmd.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"177\">myApp.deploy.cmd<\/td>\n<td valign=\"top\" width=\"390\">The auto generated command file which can be used in many situations.&nbsp; Check <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ff356104.aspx\">MSDN topic<\/a> for details.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"177\">myApp.SetParameters.xml<\/td>\n<td valign=\"top\" width=\"390\">The parameter file that user can modify to affect deployed IIS application, such as IIS application name, connection string etc.&nbsp; Check <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ff398068.aspx\">MSDN topic<\/a> for more details.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"177\">myApp.SourceManifest.xml<\/td>\n<td valign=\"top\" width=\"390\">The source manifest file that VS uses to compile the package via web deploy.&nbsp; Not useful after the package is generated.&nbsp; But user can have a quick peek on what web deploy provider is used when generating package.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"177\">myApp.zip<\/td>\n<td valign=\"top\" width=\"390\">The package zipped file<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>It&rsquo;s very common to deploy our package to a IIS7 virtual application under Default Web Site.&nbsp; Since web deploy can generate a virtual application if it&rsquo;s not exist, we can use the following options:<\/p>\n<p>1. Manually import the zip file from IIS manager and change the &ldquo;Application Path&rdquo; in the &ldquo;Import Application Package&rdquo; Wizard.&nbsp; (<a href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkId=148349\">Import a Package through IIS Manager<\/a> )<\/p>\n<p>2. Change myApp.SetParameters.xml node value of parameter &ldquo;IIS Web Application Name&rdquo;:<\/p>\n<blockquote>\n<p>&lt;setParameter name=&#8221;IIS Web Application Name&#8221; value=&#8221;Default Web Site\/test1&#8243; \/&gt; <\/p>\n<\/blockquote>\n<blockquote>\n<p>Then run &ldquo;AppServer.cmd \/y&rdquo; from command line<\/p>\n<\/blockquote>\n<p>3. In command line or batch file<\/p>\n<blockquote>\n<p>Set _ArgMsDeployAdditionalFlags=-setParam:&#8221;IIS Web Application Name&#8221;=&#8221;Default Web Site\/test1&#8243;<\/p>\n<p>AppServer.cmd \/y<\/p>\n<p>Set _ArgMsDeployAdditionalFlags=<\/p>\n<\/blockquote>\n<p>4. One line command to deploy the package create virtual application under default web site:<\/p>\n<blockquote>\n<p>&#8220;D:Program FilesIISMicrosoft Web Deploymsdeploy.exe&#8221; -verb:sync -source:package=WebApplication4.zip -dest:auto -setParam:&#8221;IIS Web Application Name&#8221;=&#8221;Default Web Site\/test2&#8243;<\/p>\n<\/blockquote>\n<p>&nbsp;<\/p>\n<p>Similarly, if we want to create a new website in IIS7 binding to a new port on a machine, name it AppServer, and deploy our package to it, we can use the following options:<\/p>\n<p>1. Create the new website manually in IIS manager and import package from IIS manager.&nbsp; All we need is the zip file on the machine.<\/p>\n<p>2. In command line or batch file:<\/p>\n<blockquote>\n<p>md D:inetpubwwwrootAppServer <\/p>\n<p>D:WindowsSystem32inetsrvappcmd add site \/name:AppServer \/id:22 \/bindings:http\/*:8090: \/physicalPath:D:inetpubwwwrootAppServer<\/p>\n<p>Set _ArgMsDeployAdditionalFlags=-setParam:&#8221;IIS Web Application Name&#8221;=&#8221;AppServer&#8221;<\/p>\n<p>AppServer.cmd \/y<\/p>\n<p>Set _ArgMsDeployAdditionalFlags=<\/p>\n<\/blockquote>\n<blockquote>\n<p>Or make it a little bit fancy:<\/p>\n<p>Set _ArgMsDeployAdditionalFlags=-presync:runCommand=&#8221;md D:inetpubwwwrootAppServer &amp; D:WindowsSystem32inetsrvappcmd add site \/name:AppServer \/id:22 \/bindings:http\/*:8090: \/physicalPath:D:inetpubwwwrootAppServer&#8221; -setParam:&#8221;IIS Web Application Name&#8221;=&#8221;AppServer&#8221;<\/p>\n<\/blockquote>\n<blockquote>\n<p>AppServer.cmd \/y<\/p>\n<\/blockquote>\n<blockquote>\n<p>Set _ArgMsDeployAdditionalFlags=<\/p>\n<\/blockquote>\n<p>3. One line command to create a new web site in IIS and deploy package to it.&nbsp; All we need is the zip file on the machine.<\/p>\n<blockquote>\n<p>&#8220;D:Program FilesIISMicrosoft Web Deploymsdeploy.exe&#8221; -verb:sync -presync:runCommand=&#8221;md D:inetpubwwwrootAppServer &amp; D:WindowsSystem32inetsrvappcmd add site \/name:AppServer \/id:22 \/bindings:http\/*:8090: \/physicalPath:D:inetpubwwwrootAppServer &#8221; -source:package=WebApplication2.zip -dest:auto -setParam:&#8221;IIS Web Application Name&#8221;=&#8221;AppServer&#8221;<\/p>\n<\/blockquote>\n<p>Hope this simple sample can generate more interest to use web deploy as packaging and deploying method.<\/p>\n<p>&nbsp;<\/p>\n<p>Xinyang Qiu<\/p>\n<p>Web Platform And Tools<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When a zip package is built from VS2010 web application UI (via Build Deployment Package command), or through command line (msbuild myproject.csproj \/t:package), a few files are generated in the destination folder. Here&rsquo;s some brief description: File Name Description myApp.deploy-readme.txt Read me file of how to use myApp.deploy.cmd. myApp.deploy.cmd The auto generated command file which [&hellip;]<\/p>\n","protected":false},"author":404,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[7336,7352,7323,7329],"class_list":["post-2944","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-msdeploy","tag-package","tag-visual-studio-2010","tag-web-deployment"],"acf":[],"blog_post_summary":"<p>When a zip package is built from VS2010 web application UI (via Build Deployment Package command), or through command line (msbuild myproject.csproj \/t:package), a few files are generated in the destination folder. Here&rsquo;s some brief description: File Name Description myApp.deploy-readme.txt Read me file of how to use myApp.deploy.cmd. myApp.deploy.cmd The auto generated command file which [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/2944","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/404"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=2944"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/2944\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=2944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=2944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=2944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}