Update Getting-Started-AspNetCore-Application.md

pull/902/head
maliming 6 years ago committed by GitHub
parent 9749317e3c
commit 41f128c2ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -156,6 +156,26 @@ services.AddApplication<AppModule>(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<Startup>()
.Build();
}
````
### 源码 ### 源码
从[此处](../samples/BasicAspNetCoreApplication)获取本教程中创建的示例项目的源代码. 从[此处](../samples/BasicAspNetCoreApplication)获取本教程中创建的示例项目的源代码.

Loading…
Cancel
Save