While updating my app to use the razor pages structure in ASP.NET Core 2.1 from MVC, some of my links stopped working.
(在更新我的应用程序以使用MVC的ASP.NET Core 2.1中的剃须刀页面结构时,我的某些链接停止了工作。)
Basically - when doing asp-page="Example"
The generated code will be
(基本上-做asp-page="Example"
,生成的代码将是)
site?page=Example
insted of
(装的)
site/Example
This happens when trying to use asp-controller, asp-area and any other taghelper , same as in the asp-page example
(尝试使用asp-controller,asp-area和任何其他taghelper时会发生这种情况 ,与asp-page示例中的相同)
This only happens on a specific page - happens to be the Home/Index page.
(这仅在特定页面上发生-恰好是“主页/索引”页面。)
Here are the relevant parts from Startup.cs
(这是Startup.cs中的相关部分)
ConfigureServices:
(ConfigureServices:)
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
Configure:
(配置:)
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
ask by George97 translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…