上QQ阅读APP看书,第一时间看更新
Configuring a website in the portal
Next, we need to create a website in Azure to publish our site on. We'll do this using the following procedure:
- From the Create New menu, go to COMPUTE | WEB SITE | QUICK CREATE and pick a name for the website:
- Click on CREATE WEBSITE and you should see your new website listed in the portal:
- Click on the newly listed website to go to the website's workspace:
- We're going to enable staged deployments, so we can deploy to a staged environment for testing, and then swap later for production (in Chapter 2, Designing a System for Microsoft Azure, we covered a section on environments and we're going to use a staging slot for testing). First, we need to put the website in a STANDARD service mode; so click on the SCALE tab and click on STANDARD under the WEB HOSTING PLAN MODE section:
- Watch the INSTANCE SIZE field as it may default to a large value incurring the highest cost; I dropped mine down to the smallest instance.
- Click on SAVE on the bottom toolbar, and then click on DASHBOARD so that we can enable staging:
- Click on the Add a new deployment slot link, enter a name for the deployment slot (staging is a sensible choice), and then click on the tick button. We'll see that the new staging site appears under the main site by clicking on the arrow:
- To publish the website, go to BUILD | Publish CustomerWebsite (you should select the name of your project):
- Select Windows Azure Web Sites as the publish target (this is probably the quickest way to publish for the first time; the Import option allows you to import a publish profile you've downloaded from the website dashboard, and Custom allows you to manually enter the publish details):
- Sign in with the Microsoft account you are using in the Azure portal, and then select the site you want to publish to from the drop-down list:
- Next, we will review the publish profile details. We can change the build and database connection options in the next settings wizard, but we can publish straight from here by clicking on Publish:
- Once we do this, we will see the publish profile included in the solution, which will speed up the process on the subsequent publish:
- We can watch the deployment process in the output window in Visual Studio; then, the default browser should launch, displaying our website in the Azure!