Razor Pages is a new feature of ASP.NET Core Model-View-Controller (MVC). Razor Pages simplifies coding page-focused scenarios to increase productivity. This topic describes how to create an ASP.NET Core application and deploy the application in Web+. It uses a Razor Pages web application as an example.
Step 1: Use Visual Studio to create an application
- Use Visual Studio to create a new project and select Web Application.
- On the Configure your new project page, enter webplusdemo in the Project name field and click Create.
- In Web+, you can configure HTTPS for a reverse proxy or SLB. In this example, the HTTPS URL is removed and only the HTTP URL is retained. The following figure shows how to modify the
applicationURLattribute in the Properties/launchSettings.json file.
- Open a browser and enter http://localhost:5000/ in the address bar to visit the homepage of the application.
Step 2: Package the application
- On the top navigation bar of Visual Studio, choose , and specify a target directory.
- You can open a shell and navigate to the directory to view generated files.
- Use the following command to archive the project and name the deployment package webplusdemo.zip.
zip -r webplusdemo.zip . /
Step 3: Deploy an application in Web+
- Log on to the Web App Service console and select the required region in the upper-left corner of the page.
- On the Overview page, click Create in the upper-right corner of the Last Updated Deployment Environments section.
- In the Basic Information step, select ASP.NET Core in the Tech Stack Type field and enter an application name and description. Click Next after the configuration is complete.
- In the Environment Information step, enter a environment name, select Upload Local Application in the Deployment Package Source field, and upload the webplusdemo.zip deployment package. After configuring the deployment package version, click Creation Complete.
- In the Creation Complete step, click View Application or Creation Complete to go to the Overview tab of the Application Details page. Click the name of an environment to go to the Overview tab of the Environment Details page. Then, click the link next to the Public IP Address label to visit the homepage of the application.
- For more information about how to deploy an application in the console, see Deploy an application.
- For more information about how to use the CLI tool to create and deploy an application, see Use the CLI to quickly deploy applications.
- For more information about related .NET Core instructions, see .NET Core Guide.