在IIS中主机ASP Net Core应用程序时加载无限页面

时间:2016-04-05 13:31:34

标签: azure iis asp.net-web-api asp.net-core single-page-application

美好的一天,我的 ASP.Net Core 应用程序出错了。我在 Azure Cloud 中的 Windows Server 2012 上的 dnx451 框架上安装了两个ASP.NET Core网站。

当我在浏览器中导航到它们时,它们无限加载。在它发生之前我安装了HttpPlatformHandler因为以下错误,但是现在我没有看到任何异常无限加载。

我在安装HttpPlatformHandler之前看到的错误。

enter image description here

此外,

  1. 应用程序从Visual Studio和dnx web成功运行。
  2. 在启动时插入日志(发送电子邮件),不创建任何日志。
  3. 正在加载页面:
  4. enter image description here

    请帮助,谢谢。

1 个答案:

答案 0 :(得分:1)

简答

当IIS无法找到dnx.exe时,会发生无限加载。当发布无法在其输出中包含运行时时会发生这种情况。

解决方案

发布时使用--runtime标志。

cd Project01
dnvm use 1.0.0-rc1-final -runtime clr   <------ Set the active runtime.
dnu build
dnu publish --runtime active            <------ Use the runtime flag.

运行时标志提供要包含的运行时文件夹的名称或完整路径,或者为PATH上的当前运行时提供active

如果仍然没有在发布输出中包含runtimes目录,则升级到dnu的最新版本,因为旧版本中存在错误。

解释

当IIS无法找到dnx.exe时,会发生无限加载。当发布无法在其输出中包含运行时时会发生这种情况。

以下是检查缺少dnx.exe是否导致无限加载问题的方法。

  1. 发布您的网络应用程序(例如dnu publish。)
  2. 导航到发布输出目录(例如bin\output\。)
  3. 确保approot\runtimes\..\..\dnx.exe存在。
  4. 以下是发布输出必须包含的关键文件。为清楚起见,我省略了其他一些重要文件。

    \Project01\bin\output\
        approot
            packages         
            runtimes <--------------------------------This is sometimes missing.
                dnx-clr-win-x64.1.0.0-rc1-final
                    bin
                        dnx.exe <---------------------IIS needs to find this.
            src              
            global.json      
            web              
            web.cmd              
        logs
        wwwroot <-------------------------------------IIS Physical Path
    

    外部链接