eShopOnAzure 项目教程

eShopOnAzure 项目教程

eShopOnAzureAzure version of the eShopOnContainers, with implementations based on Azure services.项目地址:https://gitcode.com/gh_mirrors/es/eShopOnAzure

1. 项目的目录结构及介绍

eShopOnAzure 项目的目录结构如下:

eShopOnAzure/
├── .github/
├── src/
│   ├── Catalog.API/
│   ├── Identity.API/
│   ├── Marketing.API/
│   ├── Ordering.API/
│   ├── Payment.API/
│   ├── Shipping.API/
│   ├── Web.Blazor/
│   ├── Web.MVC/
│   └── Web.Spa/
├── tests/
├── .gitignore
├── LICENSE
├── README.md
└── global.json

目录结构介绍

  • .github/: 包含 GitHub 相关的配置文件,如 GitHub Actions 的工作流配置。
  • src/: 包含项目的源代码,分为多个 API 和 Web 应用程序。
    • Catalog.API/: 商品目录服务的 API 项目。
    • Identity.API/: 身份验证和授权服务的 API 项目。
    • Marketing.API/: 营销服务的 API 项目。
    • Ordering.API/: 订单服务的 API 项目。
    • Payment.API/: 支付服务的 API 项目。
    • Shipping.API/: 物流服务的 API 项目。
    • Web.Blazor/: 使用 Blazor 技术构建的 Web 应用程序。
    • Web.MVC/: 使用 MVC 技术构建的 Web 应用程序。
    • Web.Spa/: 使用单页应用(SPA)技术构建的 Web 应用程序。
  • tests/: 包含项目的测试代码。
  • .gitignore: Git 忽略文件配置。
  • LICENSE: 项目的开源许可证文件。
  • README.md: 项目的介绍和使用说明。
  • global.json: 项目的全局配置文件,通常用于指定 .NET SDK 版本。

2. 项目的启动文件介绍

在 eShopOnAzure 项目中,每个 API 和 Web 应用程序都有自己的启动文件。以下是一些主要的启动文件:

Catalog.API/Program.cs

using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

namespace Catalog.API
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                });
    }
}

Web.MVC/Program.cs

using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;

namespace Web.MVC
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                });
    }
}

启动文件介绍

  • Program.cs: 每个项目的启动文件,负责创建和配置主机(Host),并启动应用程序。
  • CreateHostBuilder: 创建主机构建器,配置 Web 主机默认设置,并指定 Startup 类作为应用程序的启动类。

3. 项目的配置文件介绍

eShopOnAzure 项目中包含多个配置文件,用于配置应用程序的行为和环境。以下是一些主要的配置文件:

global.json

{
  "sdk": {
    "version": "5.0.100"
  }
}

appsettings.json

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*"
}

配置文件介绍

  • global.json: 指定项目使用的 .NET SDK 版本。
  • appsettings.json: 包含应用程序的配置设置,如日志级别和允许的主机。

通过以上内容,您可以了解 eShopOnAzure 项目的目录结构、启动文件和配置文件的基本信息。

eShopOnAzureAzure version of the eShopOnContainers, with implementations based on Azure services.项目地址:https://gitcode.com/gh_mirrors/es/eShopOnAzure

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

万蝶娴Harley

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值