asp.net-core - 为什么 ASP.NET Core MVC 路由无法匹配“//”如“https://localhost:5001//?id=123”?
问题描述
ASP.NET MVC 框架可以//
像https://localhost:5001//?id=123
. 但是 ASP.NET Core MVC 不能。这是我在 ASP.NET Core MVC 中的默认路由:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
解决方案
推荐阅读
- javascript - 显示/隐藏css(复选框)和js不恢复默认图片
- flutter - 如何知道作为参数传递的函数在 Flutter 中是否是异步的并等待它?
- c - 将十进制转换为二进制以用于 AVR 程序集 Atmega32a
- firebase - Firebase Firestore 获取 Flutter 中的所有文档为空
- javascript - javascript中复制函数的两种形式
- git - 管理员可以访问我的 reflog 以恢复提交更改吗?
- c++ - c++模块和“多重定义”
- javascript - 如何通过提供动态组并对值求和来在 JavaScript 中创建层次结构数据?
- spring - Spring MVC -- Spring Data -- 创建名为“entityManagerFactory”的bean时出错
- macos - 未知的 TCP 协议 - 尝试向设备发送数据