发布Core 2.0至IIS时出现HTTP Error 500.19错误求助
Hey Diego, sorry to hear you're stuck on this frustrating error—especially since your regular MVC Framework projects run without a hitch. This issue is almost always tied to ASP.NET Core-specific IIS setup gaps, so let's walk through the most reliable fixes step by step:
1. Install the ASP.NET Core Hosting Bundle
ASP.NET Core relies on a special IIS module that isn't pre-installed on Windows 8.1. Here's how to get it:
- Open Visual Studio 2017's Installer, select Modify for your active workload, and make sure the ASP.NET and Web Development workload includes the ASP.NET Core Runtime component.
- Alternatively, grab the official ASP.NET Core 2.0 Hosting Bundle installer (it includes both the Core runtime and the required IIS module) and run it on your machine.
2. Correct IIS Express Application Pool Settings
Core projects can't run in IIS's classic pipeline mode, and they don't depend on the .NET Framework CLR. Let's verify your pool config:
- Open the IIS Express configuration file at
%USERPROFILE%\Documents\IISExpress\config\applicationhost.config - Search for your published Core site's
<site>entry, then check its associated<applicationPool>:- Ensure
managedPipelineMode="Integrated"(not Classic) - Set
managedRuntimeVersion=""—this tells IIS to use "No Managed Code" mode, which is mandatory for Core projects.
- Ensure
3. Validate the Published web.config
Your published project's web.config must have the correct aspNetCore section to launch the Core runtime. Double-check that it includes this block:
<system.webServer> <aspNetCore processPath="dotnet" arguments=".\YourProjectName.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" /> </system.webServer>
- Confirm the
argumentspath matches your actual project DLL name exactly - If this section is missing, re-publish the project from Visual Studio and double-check your "Publish to IIS" settings.
4. Check Folder Permissions
IIS Express needs proper access to your published project folder:
- Right-click the published folder > Properties > Security tab
- Add the
IIS_IUSRSgroup (or the user account your IIS Express pool runs under) and grant it Read & Execute, List Folder Contents, and Read permissions. - If you enable stdout logging later, also grant Write access to the
logssubfolder.
5. Enable Detailed Logging for Debugging
If the above steps don't resolve the error, turn on stdout logging to get precise, actionable details:
- Edit your
web.configand setstdoutLogEnabled="true" - Restart the IIS Express site
- Check the
logsfolder in your published directory—this will contain runtime logs that can pinpoint issues like missing dependencies, invalid file paths, or permission failures.
Give these steps a shot, and let me know if any of them get your Core 2.0 MVC project running smoothly!
内容的提问来源于stack exchange,提问作者Diego

