开源项目教程:Practical-Microservices-with-Dapr-and-.NET

开源项目教程:Practical-Microservices-with-Dapr-and-.NET

Practical-Microservices-with-Dapr-and-.NETPractical Microservices with Dapr and .NET, published by Packt项目地址:https://gitcode.com/gh_mirrors/pr/Practical-Microservices-with-Dapr-and-.NET

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

项目的目录结构如下:

Practical-Microservices-with-Dapr-and-.NET/
├── chapter01/
├── chapter02/
├── chapter03/
├── chapter04/
├── chapter05/
├── chapter06/
├── chapter07/
├── chapter08/
├── chapter09/
├── chapter10/
├── .gitignore
├── LICENSE
├── README.md

目录介绍

  • chapter01chapter10:每个章节对应书中的一个部分,包含该章节的代码和相关文件。
  • .gitignore:Git忽略文件,指定哪些文件和目录不需要被Git跟踪。
  • LICENSE:项目的许可证文件,本项目使用MIT许可证。
  • README.md:项目的说明文件,包含项目的基本信息和使用指南。

2. 项目的启动文件介绍

项目的启动文件通常位于每个章节的目录中,以下是一个典型的启动文件示例:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace chapter01
{
    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:这是项目的入口文件,包含Main方法,用于启动应用程序。
  • CreateHostBuilder:创建并配置主机,使用Startup类进行进一步的配置。

3. 项目的配置文件介绍

项目的配置文件通常包括appsettings.jsonlaunchSettings.json,以下是这两个文件的示例:

appsettings.json

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

launchSettings.json

{
  "profiles": {
    "NET Launch w/Dapr (webapi)": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "https://localhost:5001;http://localhost:5000"
    },
    "NET Core Launch w/Dapr (webapi2)": {
      "commandName": "Project",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      },
      "applicationUrl": "https://localhost:5003;http://localhost:5002"
    }
  }
}

配置文件介绍

  • appsettings.json:包含应用程序的配置设置,如日志级别和允许的主机。
  • launchSettings.json:包含开发环境的配置,如启动浏览器和环境变量。

以上是关于Practical-Microservices-with-Dapr-and-.NET项目的目录结构、启动文件和配置文件的介绍。希望这些信息能帮助你更好地理解和使用该项目。

Practical-Microservices-with-Dapr-and-.NETPractical Microservices with Dapr and .NET, published by Packt项目地址:https://gitcode.com/gh_mirrors/pr/Practical-Microservices-with-Dapr-and-.NET

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

羿恒新Odette

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

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

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

打赏作者

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

抵扣说明:

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

余额充值