Deploying the movie booking app

We have already deployed one of our sample web apps in Azure and this is no different. The assumption here is that the reader already has an Azure subscription and is logged in with the email ID used for the subscription. If this is not the case, please go through the previous chapters where we have discussed Azure subscription at length. Let's have a look at steps to deploy our movie booking app on the cloud: 

  1. In the Visual Studio Solution Explorer window, right-click on the MovieBooking project and then click Publish. It will open a Publish dialog.
  1. Select Create New and then click OK. It will open the Create App Service dialog. Enter the required fields, as shown in the following screenshot:
  1. After filling in all the required input, click on Services on the left panel. It will display the following dialog:
  1. We need a database for our app to function and the dialog shows the SQL Database as the additional Azure resource that we need to deploy. Click on the + icon on the right-hand side. It will open a new dialog Configure SQL Database, as shown in the following screenshot:
  1. Enter the required details. Make a note of the username and password as well as the database name and connection string name, as these will be used in the code. Click OK and then click Create. This will create the publish profile and deploy the app.
  1. However, we need to ensure that our database gets created, our intended connection string is used, and migrations are applied. To do so, in the Publish window, click on the Settings link, as shown in the following screenshot: 
  1. The Publish dialog will open. On the Settings tab, ensure that for DefaultConnection, under the Databases section, the Use this connection string at runtime checkbox is checked, as shown in the following screenshot:
  1. If you deploy for the first time, you may also see Entity Framework Migrations, just like the Databases section shown in the preceding screenshot. If so, please check Apply this migration on publish. Since I have already applied the migrations, I don't have it in in preceding screenshot.
  2. Click Save and then click Publish. This will publish the web app as well as the database and migrations.

With this, our web app is deployed and after successful deployment, the app will automatically be launched in the browser. The sample app can be seen at http://packtmoviebookingapp.azurewebsites.net/.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset