gpt4 book ai didi

c# - 我可以在 ASP.NET Core 项目上将 URL Rewrite 与 web.config 一起使用吗?

转载 作者:行者123 更新时间:2023-12-05 03:48:24 27 4
gpt4 key购买 nike

我收到了相互矛盾的信息,希望有人能给我指出正确的方向。

我有几个托管在 Azure 中的 API,我想重定向这些 URL。我尝试使用应用程序服务中的 web.config 来重写 URL,但它不起作用,经过一些研究,有一些证据表明它不起作用,应该使用中间件,而其他信息表明中间件是最佳实践。

我的目标是在某个时候实现中间件,但想知道我是否可以在处理该中间件时使用 web.config 作为权宜之计。

谁能给我一个明确的答案?如果可能,最好提供一些备份信息?

谢谢

最佳答案

是的,您可以,但需要注意的是。摘自 this document :

The table indicates native IIS modules that are functional with ASP.NET Core apps and the ASP.NET Core Module.

Module             Functional with ASP.NET Core apps    ASP.NET Core Option
----------------------------------------------------------------------------
URL Rewriting† Yes URL Rewriting Middleware

需要注意的是 :

The URL Rewrite Module's isFile and isDirectory match types don't work with ASP.NET Core apps due to the changes in directory structure.

关于c# - 我可以在 ASP.NET Core 项目上将 URL Rewrite 与 web.config 一起使用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64418078/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com