Я пытаюсь добавить представление в свой проект ASP.NET Core MVC и получаю сообщение об ошибке.
Сообщение об ошибке:
There was an error running the selected code generator:
'Value cannot be null.
Parameter name:path'
Представление будет использоватьсядля ViewComponent.
Мои шаги
Right click ->
Add View ->
Type View Name ->
Uncheck 'Use a Layout Page' ->
Template : Empty ->
Click Add.
Я искал об этом, но не могу найти результат.
РЕДАКТИРОВАТЬ:
ВотStartup.cs
namespace Udemy.MvcWebUI
{
public class Startup
{
// This method gets called by the runtime. Use this method to add
//services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddScoped<IUsersService, UsersManager>();
services.AddScoped<IUsersDAL, EFUsersDAL>();
services.AddScoped<IUsersInfoService, UsersInfoManager>();
services.AddScoped<IUsersInfoDAL, EFUsersInfoDAL>();
services.AddScoped<IEventTypesService, EventTypesManager>();
services.AddScoped<IEventTypesDAL, EFEventTypesDAL>();
services.AddScoped<IEventsService, EventsManager>();
services.AddScoped<IEventsDAL, EFEventsDAL>();
services.AddScoped<ICityService, CityManager>();
services.AddScoped<ICityDAL, EFCityDAL>();
services.AddScoped<IDistrictService, DistrcitManager>();
services.AddScoped<IDistrictDAL, EFDistrictDAL>();
services.AddDbContext<EventContext>(options => options.UseSqlServer(@"Server=localhost\SQLEXPRESS;Database=Events;
User Id=sa;Password=Omurcan.1994;"));
services.AddMvc();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseFileServer();
app.UseNodeModules(env.ContentRootPath);
app.UseMvcWithDefaultRoute();
// db tanimi icin
using (var serviceScope = app.ApplicationServices.GetService<IServiceScopeFactory>().CreateScope())
{
var context = serviceScope.ServiceProvider.GetRequiredService<EventContext>();
context.Database.EnsureCreated();
}
}
}
}
Как это исправить?
Спасибо за вашу помощь.