IIS error localhost 500 unable to load request.

Jorge Germano 20 Reputation points
2025-11-16T19:21:03.9966667+00:00

Hello,

Im trying to deploy my c# webapi with swagger in IIS in port 8080. I can run fine when debugging in visual studio but in IIS im getting this error in event viewer:

Could not load configuration. Exception message:

Unable to get required configuration section 'system.webServer/aspNetCore'. Possible reason is web.config authoring error.

I already have the bundle installed the same version 8.0 as i have in target framework.

One thing i noticed it cannot create the log in my logs folder inside wwwrot/BARCODE_Products_API/logs.

Here is my webconfig:

<?xml version="1.0" encoding="utf-8"?>

<configuration>

<system.webServer>

<handlers>

  <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />

</handlers>

<aspNetCore processPath="C:\inetpub\wwwroot\RESTAPI-BARCODE_PRODUCTS\RESTAPI-BARCODE_PRODUCTS.exe"

            stdoutLogEnabled="true"

            stdoutLogFile="C:\inetpub\wwwroot\RESTAPI-BARCODE_PRODUCTS\logs\stdout"

            hostingModel="inprocess">

  <environmentVariables>

    <add name="DB_PASSWORD" value="jg93"/>

  </environmentVariables>

</aspNetCore>

</system.webServer>

</configuration>

Any idea what im doing wrong?

Windows development | Internet Information Services
0 comments No comments
{count} votes

Answer accepted by question author
  1. Tom Tran (WICLOUD CORPORATION) 3,120 Reputation points Microsoft External Staff Moderator
    2025-11-17T03:24:05.9866667+00:00

    Hi @Jorge Germano ,

    Thanks for sharing your details!

    The error you are seeing:

    Unable to get required configuration section 'system.webServer/aspNetCore'. Possible reason is web.config authoring error.

    From my understanding, this usually means IIS cannot interpret the <aspNetCore> section in web.config.

    I would recommend you try these workarounds first:


    1. Repair or install the .NET 8 Hosting Bundle

    The Hosting Bundle for .NET 8 might not be installed properly or needs repair so you can try to download and run the Hosting Bundle installer again, then restart your server.


    2. Verify ANCM V2 is present in IIS

    The ASP.NET Core Module (ANCM) V2 might also not be installed or registered correctly. IIS needs this module to process ASP.NET Core apps.

    In IIS Manager → Modules, confirm AspNetCoreModuleV2 exists. Also check C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll.

    Reference: ASP.NET Core Module (ANCM) for IIS


    3. Set Application Pool to No Managed Code

    In IIS Manager → Application Pools → Your pool → .NET CLR Version = No Managed Code.

    Reference: https://stackoverflow.com/questions/78237285/asp-net-core-8-is-missing-from-application-pool-selection-after-install


    4. Match processPath to your deployment type

    The web.config you shared is structurally correct for an ASP.NET Core app hosted in IIS with the in‑process model. If you published:

    • Self-contained: keep .exe in processPath.
    • Framework-dependent: switch to processPath="dotnet" with the .dll in arguments.

    Reference: Configuration of ASP.NET Core Module with web.config


    5. Create and permission the logs folder

    Ensure the folder exists and grant Modify rights to IIS_IUSRS and the app pool identity.

    Reference: Troubleshoot ASP.NET Core on IIS


    There are also other posts that go more in-depth to these troubleshooting steps, I highly recommend you check them out for better understanding of this issue:

    Disclaimer: Some of these links are from third-party websites and not from Microsoft official documentation so use them for information only. Please do not click or download any strange pop-ups that you might encounter.


    Hope this helps! If you have any questions left, please comment below. I'll be happy to help out!

    2 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Q&A Assist
    2025-11-16T19:21:19.2733333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error message you are encountering, "Unable to get required configuration section 'system.webServer/aspNetCore'", suggests that there may be an issue with your web.config file. Here are some steps you can take to troubleshoot and resolve the issue:

    1. Check the web.config Structure: Ensure that your web.config file is correctly structured and that there are no syntax errors. The provided web.config looks mostly correct, but make sure that the indentation and formatting are consistent.
    2. Verify the ASP.NET Core Module: Ensure that the AspNetCoreModuleV2 is installed and correctly configured. Since you mentioned having the correct version of the .NET Hosting Bundle installed, this should be fine, but double-check that there are no issues with the installation.
    3. Log File Permissions: The inability to create logs in your specified logs folder could be due to permission issues. Ensure that the application pool identity has write permissions to the C:\inetpub\wwwroot\RESTAPI-BARCODE_PRODUCTS\logs directory. You can do this by right-clicking the folder, selecting Properties, and adjusting the Security settings.
    4. Correct the stdoutLogFile Path: Since you are specifying an absolute path for stdoutLogFile, ensure that the path is accessible and that the folder exists. If the folder does not exist, create it manually.
    5. Check for Missing Configuration: Ensure that the web.config file is present in the deployment and that its contents are correct. If the file is missing or malformed, it can lead to configuration errors.
    6. Application Pool Configuration: Verify that the application pool is set to use the correct version of the .NET CLR (in this case, it should be set to No Managed Code for ASP.NET Core applications).
    7. Event Viewer Logs: Continue to monitor the Event Viewer for any additional error messages that might provide more context about the failure.
    8. Test the Application: You can also run the application directly from the command line to see if any errors are outputted that may not appear in the Event Viewer. Navigate to the deployment folder and run the executable to check for any startup errors.

    By following these steps, you should be able to identify and resolve the configuration issue that is preventing your application from starting correctly in IIS.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.