繁体   English   中英

在IIS上运行.NET Core 2.0,给出404

[英]Run .NET Core 2.0 on IIS giving 404

我试图在IIS上运行我的.NET Core 2.0应用程序,但我总是得到一个网页,无法找到404例外

当我转到事件查看器时,我收到以下消息:

Application 'MACHINE/WEBROOT/APPHOST/SPADWATCH' started process '516' successfully and is listening on port '18579'.

这是我做的设置:

我尽可能地遵循以下指南: 指南 首先我安装了.NET Core运行时(正如您在模块页面中看到的那样)。
模块

我还改编了应用程序池:

池

这是我在program.cs文件中的代码:

public class Program
{
    public static void Main(string[] args)
    {
        BuildWebHost(args).Run();
    }

    public static IWebHost BuildWebHost(string[] args) =>
        WebHost.CreateDefaultBuilder(args)
            .UseStartup<Startup>()
            .Build();
}

我的startup.cs

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();
    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }

        app.UseMvc();
    }
}

以及自动生成的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="dotnet" arguments=".\TestWebApplication1.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
</configuration>
<!--ProjectGuid: 5a95b46e-f37a-4205-b510-9fdc76cdddfa-->

我忘记了什么吗?

这是我的一个愚蠢的错误,显然我使用了错误的网址。 但我在这里发布的配置有效!

暂无
暂无

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

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