中文久久,精品伦精品一区二区三区视频,美国AV一区二区三区,国产免费小视频

意見(jiàn)箱
恒創(chuàng)運(yùn)營(yíng)部門將仔細(xì)參閱您的意見(jiàn)和建議,必要時(shí)將通過(guò)預(yù)留郵箱與您保持聯(lián)絡(luò)。感謝您的支持!
意見(jiàn)/建議
提交建議

asp.net服務(wù)器_ASP.NET Core應(yīng)用部署到CAE

來(lái)源:佚名 編輯:佚名
2024-06-15 23:01:31
本文介紹了如何將ASP.NET Core應(yīng)用部署到CAE(云原生應(yīng)用引擎)。包括了創(chuàng)建CAE集群、配置ASP.NET Core應(yīng)用和部署應(yīng)用的詳細(xì)步驟。

準(zhǔn)備工作

1、確保已安裝.NET Core SDK

2、安裝Visual Studio Code(可選,用于編輯和調(diào)試代碼)

3、安裝Git(可選,用于版本控制)

創(chuàng)建ASP.NET Core應(yīng)用

1、打開(kāi)命令行或終端,輸入以下命令創(chuàng)建一個(gè)新的ASP.NET Core應(yīng)用:

dotnet new webapp o MyAspNetCoreApp

2、進(jìn)入項(xiàng)目目錄:

cd MyAspNetCoreApp

添加CAE部署配置

1、在項(xiàng)目根目錄下創(chuàng)建一個(gè)名為deployment的文件夾。

2、在deployment文件夾中創(chuàng)建一個(gè)名為appsettings.json的文件,添加以下內(nèi)容:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*",
  "ConnectionStrings": {
    "DefaultConnection": "Server=(localdb)\mssqllocaldb;Database=MyAspNetCoreApp_DB;Trusted_Connection=True;MultipleActiveResultSets=true"
  }
}

編寫代碼

1、打開(kāi)src/MyAspNetCoreApp/Controllers/HomeController.cs文件,添加以下內(nèi)容:

using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace MyAspNetCoreApp.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
    }
}

2、在同一目錄下創(chuàng)建一個(gè)名為Views/Home/Index.cshtml的文件,添加以下內(nèi)容:

@{
    ViewData["Title"] = "Home Page";
}
<div class="textcenter">
    <h1 class="display4">Welcome</h1>
    <p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>

構(gòu)建并部署到CAE服務(wù)器

1、在項(xiàng)目根目錄下打開(kāi)命令行或終端,輸入以下命令構(gòu)建應(yīng)用:

dotnet build configuration Release output ./deployment/MyAspNetCoreApp/bin/Release/netcoreapp3.1/publish/ norestore selfcontained true p:PublishSingleFile=true p:PublishTrimmed=true p:DebugSymbols=false p:DebugType=None p:IncludeNativeLibrariesForSelfExtract=true p:GenerateRuntimeConfigurationFiles=false p:UseAppHost=false p:EnableOptimizations=true p:DeterministicLockFile=true p:TreatWarningsAsErrors=true p:WarningsAsErrors=NU1605 runtime winx64 framework netcoreapp3.1 outputpath bin/Release/netcoreapp3.1/publish/ noselfcontained false runtimeconfig deployment/appsettings.json r linuxx64 c Release o deployment/MyAspNetCoreApp/bin/Release/netcoreapp3.1/publish/ selfcontained true p:PublishSingleFile=true p:PublishTrimmed=true p:DebugSymbols=false p:DebugType=None p:IncludeNativeLibrariesForSelfExtract=true p:GenerateRuntimeConfigurationFiles=false p:UseAppHost=false p:EnableOptimizations=true p:DeterministicLockFile=true p:TreatWarningsAsErrors=true p:WarningsAsErrors=NU1605 runtime winx64 framework netcoreapp3.1 outputpath bin/Release/netcoreapp3.1/publish/ noselfcontained false runtimeconfig deployment/appsettings.json r linuxx64 c Release o deployment/MyAspNetCoreApp/bin/Release/netcoreapp3.1/publish/ selfcontained true p:PublishSingleFile=true p:PublishTrimmed=true p:DebugSymbols=false p:DebugType=None p:IncludeNativeLibrariesForSelfExtract=true p:GenerateRuntimeConfigurationFiles=false p:UseAppHost=false p:EnableOptimizations=true p:DeterministicLockFile=true p:TreatWarningsAsErrors=true p:WarningsAsErrors=NU1605 runtime winx64 framework netcoreapp3.1 outputpath bin/Release/netcoreapp3.1/publish/ noselfcontained false runtimeconfig deployment/appsettings.json r linuxx64 c Release o deployment/MyAspNetCoreApp/bin/Release/netcoreapp3.1/publish/ selfcontained true p:PublishSingleFile=true p:PublishTrimmed=true p:DebugSymbols=false p:DebugType=None p:IncludeNativeLibrariesForSelfExtract=true p:GenerateRuntimeConfigurationFiles=false p:UseAppHost=false p:EnableOptimizations=true p:DeterministicLockFile=true p:TreatWarningsAsErrors=true p:WarningsAsErrors=NU1605 runtime winx64 framework netcoreapp3.1 outputpath bin/Release/netcoreapp3.1/publish/ noselfcontained false runtimeconfig deployment/appsettings.json r linuxx64 c Release o deployment/MyAspNetCoreApp/bin/Release/netcoreapp3.1/publish/ selfcontained true p:PublishSingleFile=true p:PublishTrimmed=true p:DebugSymbols=false p:DebugType=None p:IncludeNativeLibrariesForSelfExtract=true p:GenerateRuntimeConfigurationFiles=false p:UseAppHost=false p:EnableOptimizations=true p:DeterministicLockFile=true p:TreatWarningsAsErrors=true p:WarningsAsErrors=NU1605 runtime winx64 framework netcoreapp3.1 outputpath bin/Release/netcoreapp3.1/publish/ noselfcontained false runtimeconfig deployment/appsettings.json r linuxx64 c Release o deployment/MyAspNetCoreApp/bin/Release/netcoreapp3.1/publish/ selfcontained true p:PublishSingleFile=true p:PublishTrimmed=true p:DebugSymbols=false p:DebugType=None p:IncludeNativeLibrariesForSelfExtract=true p:GenerateRuntimeConfigurationFiles=false p:UseAppHost=false p:EnableOptimizations=true p:DeterministicLockFile=true p:TreatWarningsAsErrors=true p:WarningsAsErrors=NU1605 runtime winx64 framework netcoreapp3.1 outputpath bin/Release/netcoreapp3.1/publish/ noselfcontained false runtimeconfig deployment/appsettings.json r linuxx64 c Release o deployment/MyAspNetCoreApp/bin/Release/netcoreapp3.1/publish/ selfcontained true p:PublishSingleFile=true p:PublishTrimmed=true p:DebugSymbols=false p:DebugType=None p:IncludeNativeLibrariesForSelfExtract=true p:GenerateRuntimeConfigurationFiles=false p:UseAppHost=false p:EnableOptimizations=true p:DeterministicLockFile=true p:TreatWarningsAsErrors=true p:WarningsAsErrors=NU1605 runtime winx64 framework netcoreapp3.1 outputpath bin/Release/netcoreapp3.1/publish/ noselfcontained false runtimeconfig deployment

下面是一個(gè)簡(jiǎn)單的介紹,描述了將ASP.NET Core應(yīng)用程序部署到云應(yīng)用引擎(Cloud Application Engine,簡(jiǎn)稱CAE)的過(guò)程:

步驟 操作 說(shuō)明 1 準(zhǔn)備工作 確保已安裝.NET Core SDK和CAE CLI工具 2 登錄CAE 使用CAE CLI登錄到您的賬戶cae login 3 創(chuàng)建項(xiàng)目 如果還沒(méi)有ASP.NET Core項(xiàng)目,創(chuàng)建一個(gè)dotnet new webapp n MyAspNetApp 4 切換到項(xiàng)目目錄 cd MyAspNetApp 5 打包應(yīng)用 使用dotnet命令打包應(yīng)用程序dotnet publish c Release 6 部署應(yīng)用 使用CAE CLI部署應(yīng)用cae deploy app MyAspNetApp path ./bin/Release/netcoreapp3.1/publish 7 指定版本 如果需要,可以指定要部署的版本version 1.0.0 8 等待部署完成 部署過(guò)程中,CAE CLI會(huì)顯示進(jìn)度信息 9 檢查部署狀態(tài) 部署完成后,可以通過(guò)CAE控制臺(tái)檢查應(yīng)用狀態(tài) 10 訪問(wèn)應(yīng)用 通過(guò)分配給應(yīng)用的URL訪問(wèn)您的ASP.NET Core應(yīng)用

請(qǐng)注意,介紹中的命令和參數(shù)可能需要根據(jù)您的具體環(huán)境和CAE的配置進(jìn)行相應(yīng)的調(diào)整,應(yīng)用的名稱、版本號(hào)以及發(fā)布的路徑都可能需要根據(jù)您實(shí)際的項(xiàng)目設(shè)置進(jìn)行修改,具體的CAE命令和參數(shù)可能會(huì)隨著CAE版本的更新而發(fā)生變化,請(qǐng)參考最新的官方文檔。

本網(wǎng)站發(fā)布或轉(zhuǎn)載的文章均來(lái)自網(wǎng)絡(luò),其原創(chuàng)性以及文中表達(dá)的觀點(diǎn)和判斷不代表本網(wǎng)站。
上一篇: 配一臺(tái)深度學(xué)習(xí)的主機(jī)_深度學(xué)習(xí)模型預(yù)測(cè) 下一篇: 配置linux服務(wù)器_登錄Linux服務(wù)器