环境:net core 7.0
第一行代码:
var builder = WebApplication.CreateBuilder(args); // 1 忘记了Application,创建ApplicationBuilder Microsoft.AspNetCore.Builder
第二行代码:
builder.Services.AddControllers();private static IMvcCoreBuilder AddControllersCore(IServiceCollection services) { // This method excludes all of the view-related services by default. var builder = services .AddMvcCore() .AddApiExplorer() .AddAuthorization() .AddCors() .AddDataAnnotations() .AddFormatterMappings(); if (MetadataUpdater.IsSupported) { services.TryAddEnumerable( ServiceDescriptor.Singleton<IActionDescriptorChangeProvider, HotReloadService>()); } return builder; }
标签:core,builder,var,理解,services,net,代码 From: https://www.cnblogs.com/Insist-Y/p/17399225.html