2017-02-15 75 views

回答

5

我找到了解決方案,通過調用

services.AddSingleton<Microsoft.AspNetCore.Mvc.Controllers.IControllerFactory, MyOwnImplementationClassOfControllerFactory>(); 

這個地方在啓動=> ConfigureServices正確調用services.AddMvc(); 其中MyOwnImplementationClassOfControllerFactory是IControllerFactory的自定義實現所派生形式之前DefaultControllerFactory

我以前單身,因爲我發現default implementation使用下面的調用services.TryAddSingleton<IControllerFactory, DefaultControllerFactory>();

相關問題