diff --git a/docs/zh-Hans/Getting-Started-AspNetCore-Application.md b/docs/zh-Hans/Getting-Started-AspNetCore-Application.md index d0733bb140..cf9ac3f66f 100644 --- a/docs/zh-Hans/Getting-Started-AspNetCore-Application.md +++ b/docs/zh-Hans/Getting-Started-AspNetCore-Application.md @@ -156,6 +156,26 @@ services.AddApplication(options => }); ```` +4. 更新 `Program.cs`代码, 不再使用`WebHost.CreateDefaultBuilder()`方法(因为它使用默认的DI容器): + + ````csharp +public class Program +{ + public static void Main(string[] args) + { + BuildWebHostInternal(args).Run(); + } + public static IWebHost BuildWebHostInternal(string[] args) => + new WebHostBuilder() + .UseKestrel() + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseIISIntegration() + .UseStartup() + .Build(); +} +```` + + ### 源码 从[此处](../samples/BasicAspNetCoreApplication)获取本教程中创建的示例项目的源代码.