Vous êtes sur la page 1sur 6

Project Deployment Guide

S o far you ve only been testing your ASP.NET MVC web application on your local machine, the development is not complete as your application does not allow external users to connect and user the application. To allow access from external users, you have to deploy your web application to an external production server capable of handling request from multiple internet users. This section will walk you through the deployment process using Visual Studio Express 2012 for Web.

Prepare the "Web.Release" Conguration File


You can find the "Web.cong" le in the solution explorer. The le is an XML document that denes conguration information regarding the web application. When your web application is running on your local machine or the production server, the server will look into the "Web.cong" le and act according to its conguration, e.g. connect to the database, load the corresponding helpers, etc. There are 2 sets of configurations under the "Web.cong" le: the "Web.Debug.cong" le denes the conguration of your local computer, and the "Web.Release.cong" le denes the conguration of your production server. Unlike your local machine, the production server uses a slightly different mechanism to connect to the database les, thus you have to modify the "Web.Release.cong" le to inclide the production servers database congurations. You need to specify a different connection string for your web applications databases running under the production server. To change the connection string, you have to implement an "appsetting transformation" in the "Web.Release.cong" le. N ow, open the "Web .R elease . config " file in your project and delete everything inside. Download the "Web.Release.cong" le from Moodle under MiniProject, then copy and paste the entirety of its content to your empty "Web.Release.cong" le.

Figure 218: Web.cong File in Project Solution

150

planning , designing , and programming for web application

Personalize the "Web.Release.cong" File


U pon pasting the content into your "Web .R elease . config ", customize the content with your own UID and Entity Framework Model. Refer to gure 219, change the highlighted sections as instructed on the gure.

Figure 219: Modications to "Web.Release.cong"

A fter making these changes, save the "Web.Release.cong" le now and proceed to change the publish settings.

project deployment guide

151

Specify The Publish Setting

R efer to gure 220, select "Project Project Properties" to open the project properties page.
Figure 220: Open the Project Properties Page

F or the "Package /P ublish Web " options, select "Release" conguration, and select "All les in this project folder" so that all your images and the membership account database can also be deployed.

Figure 221: Release Conguration for Web Publishing

152

planning , designing , and programming for web application

Publish to File System


P ublish your web application by rightclicking on the name of the ASP.NET MVC web application project then select "Publish"
Figure 222: RightClick & Select Publish

C reate a new publish profile by clicking on the dropdown list and select "New Prole"

Figure 223: Create a New Publish Prole

N ame your new publish profile so that you can simply reuse the prole later on
Figure 224: Give a Name to Your New Publish Prole

project deployment guide

153

U se "File System" as the publish method, then select a folder in your system to store the published les. To avoid confusion, it is better to select an empty folder to host your published les. When you are all set, select "Next" instead of "Publish"

Figure 225: Publish using "File System" to a Folder

E xpand the "File Publish Options", tick the option to "Delete all existing les prior to publish". Now you can select "Publish" to publish your website to the folder of your choice

Figure 226: Delete Existing Files Prior to Publish

Output Signaling Publish was Successful 2>Site was published successfully le:///U:/Publish 2> ========== Build: 1 succeeded, 0 failed, 0 uptodate, 0 skipped ========== ========== Publish: 1 succeeded, 0 failed, 0 skipped ==========

154

planning , designing , and programming for web application

Publish to Production Server using FTP Client

1. Refer to gure 227, open the FileZilla FTP Client and enter the production server login information: Production Server Login Information Host: imse2016.imse.hku.hk Username: imse2016.imse.hku.hk|your_imse_computer_login e.g. imse2016.imse.hku.hk|2012123456 Password: your_imse_computer_password Port: 2255

Figure 227: Graphical Example of the use of FileZilla FTP Client

Vous aimerez peut-être aussi