|
|
|
@ -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)获取本教程中创建的示例项目的源代码.
|
|
|
|
|