繁体   English   中英

MVC 6-在IIS上出现404错误

[英]MVC 6 - Getting 404 error on IIS

这就是我得到的

状态代码:404; 未找到

这是环境。

  • IIS 7.5
  • Windows 2008 R2
  • 安装了ASP.NET 5 RC和HttpPlatformHandler。

...以及我所做的。

1)检查web.config中指向stdoutLogFile的日志目录。 看不到任何错误。 其中很多是:

info: Microsoft.AspNet.Hosting.Internal.HostingEngine[1]
Request starting HTTP/1.1 GET <websiteName>

2)运行RDP并在approot目录中运行web.cmd后可以浏览到该站点。 网站可以正常运行。 无法使用IIS访问它。

3)Startup.cs / configure包含

app.UseStatusCodePages();
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();

4)本地发布。 复制到服务器。 网站指向wwwroot目录。 Approot坐在它旁边。

5)processPath指向“.. \\ approot \\ web.cmd”。

6)使用DNX版本dnx-clr-win-x86.1.0.0-rc1-update1发布。 还尝试了相同的64位版本。

7)已安装HttpPlatformHandler。

8)检查了IIS错误日志,没有发现任何有趣的东西。

我接下来应该尝试什么?

更新

我已经映射了这些环境变量。

DNX_HOME - C:\Users\<user>\.dnx
DNX_PACKAGES - C:\Users\<user>\.dnx\packages
DNX_PATH - C:\Users\<user>\.dnx\bin\dnvm.cmd

已安装Visual Studio 2012 Update 4的Visual C ++可再发行组件。

1)每次执行故障排除步骤时,请回收应用程序池。

2)尝试一个非常简化的应用程序。 如果您仍然收到404,那么我们知道主机不在于应用程序。

以下超级简单的应用程序在IIS中为我们工作。

C:/App00/Startup.cs

using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;

namespace App00
{
    public class Startup
    {
        public void Configure(IApplicationBuilder app)
        {
            app.Run(async context =>
            {
                await context.Response.WriteAsync("Hello from RC1!");
            });
        }
    }
}

C:/App00/project.json

{
    "dependencies": {
        "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-*"
    },
    "frameworks": {
        "dnx451": {}
    },
    "commands": {
        "web": "Microsoft.AspNet.Server.Kestrel"
    }
}

C:/App00/wwwroot/web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <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>

还原和发布

dnvm use 1.0.0-rc1-update1 -runtime clr
dnu restore
dnu publish --runtime active

IIS配置

Physical Path     C:\App00\bin\output\wwwroot

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM