强制使用SSL:尝试确定托管应用程序的DNX进程的进程ID时出错

Pio*_*rek 3 asp.net asp.net-core

我想在我的网站上使用https强制执行.如果发现这篇文章,我使用了那里的代码.不幸的是,将此代码添加到web.config后,当我尝试在本地IIS上打开我的网站时出现此错误:

尝试确定托管应用程序的DNX进程的进程ID时出错

我的web.config看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>

    <rewrite>
      <rules>
        <rule name="Force HTTPS" enabled="true">
          <match url="(.*)" ignoreCase="false" />
          <conditions>
            <add input="{HTTPS}" pattern="off" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>

    <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>
    <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

其他stackoverflow问题的解决方案,如"启用匿名身份验证"或删除project.lock.json不起作用.

我正在使用ASP.net Core RC1

小智 9

我花了几个小时的时间浏览可怕的解决方案"发生错误,以确定托管应用程序的DNX进程的进程ID"错误,直到找到Tratcher的答案 - 这没有标记为答案.

如果其他一切都失败了,并且您的项目使用或强制执行SSL而不先调试(CTRL + F5),它将要求您生成本地SSL证书,之后调试将起作用并且错误将消失.

谢谢Tratcher!