Browse Source
Update Getting-Started-AspNetCore-Application.md
pull/4228/head
maliming
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
20 additions and
0 deletions
-
docs/zh-Hans/Getting-Started-AspNetCore-Application.md
|
|
|
@ -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)获取本教程中创建的示例项目的源代码. |
|
|
|
|