【发布时间】:2019-05-16 06:37:44
【问题描述】:
我尝试使用此命令更改我的网页 Mvc 应用程序的登录页面。但是它仍然将我重定向到常规索引,而不是产品/索引。我该如何解决这个问题?
public void ConfigureServices(IServiceCollection services)
{
var connection = @"Server=localhost;Database=Electronics;Trusted_Connection=True;ConnectRetryCount=0";
services.AddDbContext<ElectronicsContext>(options => options.UseSqlServer(connection));
services.AddTransient<IProductRepository<Product>, ProductRepository>();
services.AddTransient<IProductCategoryRepository<ProductCategory>, ProductCategoryRepository>();
services.AddTransient<ICustomerRepository<Customer>, CustomerRepository>();
services.AddTransient<ISupplyRepository<Supply>, SupplyRepository>();
services.AddScoped<ShoppingCartRepository>(sp => ShoppingCartSession.GetCart(sp));
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
services.AddAutoMapper();
services.AddMvc().AddRazorPagesOptions(options =>
{
options.Conventions.AddPageRoute("/Products/Index", "");
}).SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddMemoryCache();
services.AddSession();
services.AddSingleton<IMemoryContainer,MemoryContainer>();
services.AddSingleton(new LoggerFactory().AddConsole().AddDebug());
services.AddLogging();
_logger.LogInformation("configure services log");
}
【问题讨论】:
-
所以你要更改默认根文件夹?
标签: c# html .net-core asp.net-core-mvc asp.net-core-2.0