发布到 IIS 时找不到 ASP.NET Core 页面

tun*_*i52 5 c# iis-7.5 asp.net-core

我将我的 ASP.NET Core 项目从 RC1 更新到 1.0 RTM(使用 preview2 工具),一切顺利。我可以在 Visual Studio 中毫无问题地进行调试。接下来,我想在 Windows Server 2008 R2 和 IIS 7.5 上上传该站点。我安装了必要的 Windows 托管工具并在 IIS 中创建了 Web 应用程序。问题是,在我尝试打开页面后,它返回了 404 错误。正如我在任务管理器中看到的,我的应用程序正在运行,但在侦听模式下停止。

在日志文件中,我只看到这些条目:

Hosting environment: Production
Content root path: C:\inetpub\wwwroot\MySite
Now listening on: http://localhost:20706
Application started. Press Ctrl+C to shut down.
Run Code Online (Sandbox Code Playgroud)

IIS 集成似乎存在一些问题。我的web.config文件看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="..\..\approot\MySite\MySite.exe" arguments="" forwardWindowsAuthToken="true" stdoutLogEnabled="true" />
    <httpErrors errorMode="Detailed" />
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

我从 GitHub 尝试了一些变通方法,这影响了 Startup.cs 文件的Configure方法,但没有成功。

有任何想法吗?

tun*_*i52 0

好吧,我遇到了很多问题,但我的网站无法运行的两个主要原因是:

  1. 我无法从两个不同的地方启动代码。我本来把wwwroot内容放在wwwroot文件夹下(没什么奇怪的),其余的放到approot下。现在所有内容都应该位于同一个文件夹中。
  2. 我的发行版本不想工作。我必须使用调试文件夹的内容。我不知道为什么。

而现在,一切都好起来了。