หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Cloud Application Engine/ Best Practices/ Deploying ASP.NET Core Applications to CAE

Deploying ASP.NET Core Applications to CAE

Updated on 2024-08-30 GMT+08:00

CAE source code deployment supports Docker running. You can configure a Dockerfile, install the build environment in this file, and define build commands. In this way, more projects programmed in various languages can be deployed in CAE.

This topic uses the ASP.NET Core application as an example.

Prerequisites

An environment has been created. For details, see Creating an Environment and Application Management.

Forking Sample Source Code

Use your account to log in to GitHub and fork the sample source code repository to your personal account.

Source code address: https://github.com/Azure-Samples/dotnetcore-docs-hello-world.

Parsing Dockerfile

Dockerfile file in the sample repository.

# Specify the basic image as mcr.microsoft.com/dotnet/sdk:7.0, which is used as the build environment of the ASP.NET Core project.
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
# Specify the working directory.
WORKDIR /source

# Copy the source code from the build host to the basic image and specify the working directory and build command.
COPY . ./dotnetcore-docs-hello-world/
WORKDIR /source/dotnetcore-docs-hello-world
RUN dotnet publish -c release -o /app 

# Specify the new basic image as mcr.microsoft.com/dotnet/aspnet:7.0 and copy the build product generated in step 2 to the new basic image.
FROM mcr.microsoft.com/dotnet/aspnet:7.0
WORKDIR /app
COPY --from=build /app ./

# Set the environment variable PORT and declare that the container port is 80.
ENV PORT 80
EXPOSE 80

# Specify the container startup command.
ENTRYPOINT ["dotnet", "dotnetcoresample.dll"]

Setting GitHub Repository Authorization

You can set GitHub repository authorization so that build projects and application components can use the authorization information to access the GitHub source code repository.

  1. Log in to CAE.
  2. Choose System Settings.

  3. Click Edit in the Source Code Repository Authorizations module.
  4. Click Create Authorization, select the required source code repository by referring to Table 1, and set parameters.

    Table 1 Authorization parameters

    Parameter

    Description

    Authorization

    Authorization name, which cannot be changed after being created.

    Repository Type

    The following official repositories are supported:

    1. Select GitHub.
    2. Select Method.
      • OAuth: Complete the authorization creation as prompted.
      • Token: Enter the obtained private token.

  5. Click Confirm. The GitHub code repository is authorized.

    Figure 1 Authorizing GitHub code repository

Creating and Configuring Components

  1. In the navigation pane on the left, choose Components.
  2. Select the created application and environment from the drop-down lists in the upper part of the page, and click Create Component.
  3. Configure the component by referring to Table 2.

    Table 2 Basic component information

    Parameter

    Description

    Component

    Enter a component name. In this practice, enter test-dotnet.

    Version

    Enter a component version.

    In this practice, enter 1.0.0.

    Specifications

    Select instance specifications, for example, 0.5 Core and 1 GiB.

    Instances

    Set it to 1.

    Code Source

    Choose Source code repository > GitHub. Select the authorization created in Setting GitHub Repository Authorization and select the sample code repository.

    Figure 2 Configuring basic information

  4. Set Language/Runtime System to Docker and Dockerfile Address to ./Dockerfile.linux.

    Figure 3 Configuring the Dockerfile

  5. Click Configure Component. The Component Configuration page is displayed.
  6. Go to Access Mode and click Edit.
  7. In the Access Component from Another Environment area, click Load Balancing > Add Load Balancer.

    Configure load balancing by referring to Figure 4.
    Figure 4 Configuring load balancing

  8. Click OK.
  9. Click Set and Deploy Component in the upper part of the page. In the dialog box that is displayed on the right, click OK. The configuration takes effect after the deployment is complete.

Viewing Application Details

  1. In the navigation pane on the left, choose Components to return to the components page.
  2. Click the public network access address in the Access Address column of the test-dotnet component.

  3. Access the static page of the application.

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback