Asp.net core 在IIS上的ASP.NET核心应用程序中将HTTPS站点重定向到非www

Asp.net core 在IIS上的ASP.NET核心应用程序中将HTTPS站点重定向到非www,asp.net-core,asp.net-core-mvc,asp.net-core-2.0,Asp.net Core,Asp.net Core Mvc,Asp.net Core 2.0,我不想更改我的代码 有没有通过IIS将ASP.NET核心应用程序中的HTTPS站点重定向到非www的解决方案? IIS上有解决方案吗?使用IIS URL重写模块将以下内容添加到web.config: <system.webServer> <rewrite> <rules> <rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match

我不想更改我的代码 有没有通过IIS将ASP.NET核心应用程序中的HTTPS站点重定向到非www的解决方案?
IIS上有解决方案吗?

使用IIS URL重写模块将以下内容添加到web.config:

<system.webServer>
  <rewrite>
    <rules>
      <rule name="HTTP to HTTPS redirect" stopProcessing="true"> 
        <match url="(.*)" /> 
        <conditions> 
          <add input="{HTTPS}" pattern="off" ignoreCase="true" />
        </conditions> 
        <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
      </rule> 
    </rules>
  </rewrite>
</system.webServer>


中间件。

我将其添加到web.config,它给出500-内部服务器错误。这里没有重写模块,IIS:您需要安装。