Asp.net core 2.1
Startup.cs:
public void ConfigureServices(IServiceCollection services)
{
services
.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}
public void Configure(IApplicationBuilder app)
{
if (this.HostingEnvironment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseDatabaseErrorPage();
app.UseDeveloperExceptionPage();
app.UseMvc(routes => {
routes.MapRoute(
name: "default",
template: "{controller=GenericController}/{action=Get}");
});
}
Сообщение об ошибке:
InvalidOperationException: невозможно активировать тип
'Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine. Следующие
конструкторы неоднозначны: Void
.ctor (Microsoft.AspNetCore.Mvc.Razor.IRazorPageFactoryProvider,
Microsoft.AspNetCore.Mvc.Razor.IRazorPageActivator,
System.Text.Encodings.Web.HtmlEncoder,
Microsoft.Extensions.Options.IOptions 1[Microsoft.AspNetCore.Mvc.Razor.RazorViewEngineOptions],
Microsoft.AspNetCore.Razor.Language.RazorProject,
Microsoft.Extensions.Logging.ILoggerFactory,
System.Diagnostics.DiagnosticSource) Void
.ctor(Microsoft.AspNetCore.Mvc.Razor.IRazorPageFactoryProvider,
Microsoft.AspNetCore.Mvc.Razor.IRazorPageActivator,
System.Text.Encodings.Web.HtmlEncoder,
Microsoft.Extensions.Options.IOptions
1 [Microsoft.AspNetCore.Mvc.Razor.RazorViewEngineOptions],
Microsoft.AspNetCore.Razor.Language.RazorProjectFileSystem,
Microsoft.Extensions.Logging.ILoggerFactory,
System.Diagnostics.DiagnosticSource)