90 likes | 255 Views
Deployment. Moving an ASP.NET application from the development environment to the production environment. Development environment vs. Production environment. Development environment. Production environment. Runs many (potentially thousand) user sessions simultaneously Microsoft IIS
E N D
Deployment Moving an ASP.NET application from the development environment to the production environment Deployment
Development environment vs. Production environment Development environment Production environment Runs many (potentially thousand) user sessions simultaneously Microsoft IIS Full-fledged web server Port 80 Accessible world wide • Runs a single (or few) user sessions simultaneously • Visual Studio comes with a built-in web server • Random port number • Accessible from local host, only Deployment
Avoiding hardcoded settings • Settings should not be in the pages • Example: Company name, email address, etc. • Settings should be declared in web.config <appSettings> <add key="CompanyName" value="Roskilde Used Cars"/> <add key="MaintainedBy" value="andersb@rhs.dk" /> </appSettings> • Used like <asp:Literal ID="Literal1" runat="server" Text=” <%$ AppSettings:CompanyName %> ” > </asp:Literal> • Example • Deploymentexample/MasterPages/MyMasterpage.master Deployment
Copying a web site • Visual Studio helps you make a copy of your web site Deployment
Publishing a web site • Alternative to ”Copying a web site” • Available in Visual Studio Prof. Editions • Build menu -> Publish • Pages can be precompiled • File.aspx-> file.dll • First request to a page will run faster • Compilation not required at request-time Deployment
Transportation options • When copying a web site you have 4 ways of transporting the files to the production environment • File System • Files are moved manually • Local IIS • Files are moved automatically to a local IIS • FTP Site • Files are sent to IIS using FTP (File Transfer Protocol) • Remove Site • Files are sent to IIS using IIS • Requires Front Page Server Extensions Deployment
Microsoft IIS • IIS (Formerly Internet Information Server) • Microsoft’s web server • Comes with most major Windows versions • But is not installed! • IIS must be installed and configured • Configured to execute ASP.NET Deployment
Installing and configuring IIS • Control Panel -> System and Security -> IIS Manager • Select ”Default Web site” and click ”Advanced Settings” (left) • Set Physical path • Right click ”Default Web Site” to add a new application Deployment
Further readings, etc. • Imar Spaanjaars Beginning ASP.NET 4 in C# and VB, Wrox 2010 • Chapter 19 Deploying your Web Site, page 697-730 • Configuration of IIS + deployment of Web Site Projects (not Web Application Projects) • Bill Evjen et al. Professional ASP.NET 4 in C# and VB, Wrox 2010 • Chapter 36 Packaging and Deploying ASP.NET Applications, page 1337-1367 • George Shepherd Microsoft ASP.NET 4 Step by Step, Microsoft Press 2010 • Chapter 26 Deployment, page 575-586 Deployment