简体   繁体   中英

ASP.NET Core IIS Project not running or producing any logs

I have:

  • an EC2 instance running Windows Server 2016,
  • the .NET Web Host Bundle installed (including the .NET Core 2 SDK),
  • the AspNetCoreModule installed,
  • a site in IIS10 and an app pool with no managed code,
  • the following BuildWebHost :

     public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .UseKestrel() .UseIISIntegration() .UseStartup<Startup>() .Build(); 
  • this web.config for ASP.NET Core 2 MVC in the sites root folder:

     <?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=".\\ProjectOutput.dll" stdoutLogEnabled="true" stdoutLogFile=".\\logs\\stdout" forwardWindowsAuthToken="false" /> </system.webServer> </configuration> 

What works:

  • placing an index.html with any content in the root folder of the site.
    • the content of the file is served properly when I goto the site from an external network or computer.

What doesn't work:

  • placing my published ASP.NET Core MVC site in the root folder of the site, serves a 500 Internal Server Error
    • published using dotnet publish
  • additionally, nothing is getting logged either.

What could I be missing that would cause my project to not start, without any logging?

I know I commented an houre ago, but reading this issue I thought I had the same problem. What helped for me was removing the following from the Startup.cs in the configureServices method:

Services.AddDeveloperSigningCredential();

I noticed that when publishing the application, the application in IIS was still asking for a tempkey.rsa. That's weird because this one is not published with it. So after removing the certain line of code it's all working.

Also a great tip to remember, if you can't figure out the error: go to the folder of your application. Open command. And enter: dotnet .\\NAMEOFSTARTING.DLL

This way you start your website from the command, and see possible errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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