自动将HTTP重定向到HTTPS在ASP.NET MVC中 – 如何避免它

huangapple go评论68阅读模式
英文:

HTTP redirecting to HTTPS automatically in ASP.NET MVC - how to avoid it

问题

我继承了一个 ASP MVC 应用(Framework),在解决方案属性中 > Web,它是 http 而不是 https。

当我点击 Debug > IIs Express > Edge 时,我被重定向到 https,出现错误连接,如下所示。我在应用程序中到处搜索过,但未能找到任何重定向。谢谢您的帮助。

英文:

I have inherited an ASP MVC app (Framework), in the solution properties > Web, it is http and not https

自动将HTTP重定向到HTTPS在ASP.NET MVC中 – 如何避免它

When I hit Debug > IIs Express > Edge , I get redirected to https with erro connection as you can notice hereunder
自动将HTTP重定向到HTTPS在ASP.NET MVC中 – 如何避免它
I searched everywhere in the app I was not able to find any redirect Thanks for your help

答案1

得分: 4

这可能是由HSTS自动HTTPS引起的。

  • HSTS: 您可以在Edge中导航至edge://net-internals/#hsts。在“查询域”文本框中查询“localhost”。如果找到任何内容,请在“删除域”文本框中删除“localhost”。
  • Automatic HTTPS: 在Edge中导航至edge://settings/privacy,向下滚动并找到自动切换到更安全的连接以使用自动HTTPS。检查选项是否已打开,如果是,请关闭该选项。
英文:

This might be caused by HSTS or Automatic HTTPS.

  • HSTS: You can navigate to edge://net-internals/#hsts in Edge. Query localhost in Query Domain textbox. If there's anything found, delete localhost in Delete Domain textbox.
    自动将HTTP重定向到HTTPS在ASP.NET MVC中 – 如何避免它
    自动将HTTP重定向到HTTPS在ASP.NET MVC中 – 如何避免它
  • Automatic HTTPS: Navigate to edge://settings/privacy in Edge, scroll down and find Automatically switch to more secure connections with Automatic HTTPS. Check if the option is turned on, if it is, turn off the option.
    自动将HTTP重定向到HTTPS在ASP.NET MVC中 – 如何避免它

huangapple
  • 本文由 发表于 2023年3月20日 22:52:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/75791816.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定