ASP.NET Errors Not Logging to Application Event Viewer on Windows Server 2025

Freerk Duursma 15 Reputation points
2025-06-19T09:40:09.3966667+00:00

Running ASP.NET sites in IIS on Windows Server 2025 results in ASP.NET errors failing to log correctly to the Application Event Viewer.

Whenever an event with the Source ASP.NET 4.0.30319.0 is raised, it does not show the error or stack trace. Instead, it displays the following error message:

System.Web.HttpException (0x80004005): The EventLogWebEventProvider provider failed to log an event with the error code 0x80070057.

   at System.Web.Management.EventLogWebEventProvider.ProcessEvent(WebBaseEvent eventRaised)
   at System.Web.Management.WebBaseEvent.RaiseInternal(WebBaseEvent eventRaised, ArrayList firingRuleInfos, Int32 index0, Int32 index1)

It appears that the system intends to raise an HttpException, but it cannot write it to the event viewer. We are not using any custom logging providers, but all is handled by the IIS defaults.

A testing page that raises an HTTP Exception was created and placed in the default website, running under the default ApplicationPoolIdentity. This configuration works on other servers, but fails on all Windows Server 2025 installations. Is this a known problem and are there any ways I can restore the logging functionality?

Windows for business | Windows Server | Performance | Application technologies and compatibility
{count} votes

2 answers

Sort by: Most helpful
  1. Georgiana Nitu 10 Reputation points Microsoft Employee
    2025-09-12T09:49:00.09+00:00
    2 people found this answer helpful.

  2. Finn Dang 950 Reputation points Independent Advisor
    2025-07-23T17:21:24.5233333+00:00

    Hello Freerk Duursma,

    On Windows Server 2025 the built‑in ASP.NET event source either isn’t registered correctly or the default ApplicationPoolIdentity no longer has rights to write to the Application log, so you get the 0x80070057 invalid parameter error when the EventLogWebEventProvider fires. You can restore full logging in a few minutes:

    I) Re‑register ASP.NET’s event source

    # ensure IIS‑ASP.NET45 is enabled, then:
    dism /online /enable-feature /featurename:IIS-ASPNET45 /all  
    & "$env:windir\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe" -i  
    # or simply:
    New-EventLog –LogName Application –Source "ASP.NET 4.0.30319.0"
    

    II) Grant your AppPool identity write ACLs on the log file and registry

    # replace DefaultAppPool with your pool name if different
    $appPool = "IIS APPPOOL\DefaultAppPool"
    # EVTX file ACL
    $logFile = "$env:windir\System32\winevt\Logs\Application.evtx"
    $acl    = Get-Acl $logFile
    $rule   = New-Object System.Security.AccessControl.FileSystemAccessRule($appPool, "Write","Allow")
    $acl.AddAccessRule($rule); Set-Acl $logFile $acl
    # Registry ACL
    $regKey = "HKLM:\SYSTEM\CurrentControlSet\Services\EventLog\Application"
    $acl    = Get-Acl $regKey
    $rule   = New-Object System.Security.AccessControl.RegistryAccessRule($appPool,"SetValue,WriteKey","Allow")
    $acl.AddAccessRule($rule); Set-Acl $regKey $acl
    

    III) Recycle your AppPool (or IIS) and repro

    You should now see the full exception and stack trace in the Application log.
    Workaround: If you’re still blocked, you can switch to the file‑based provider in your web.config to write errors to disk via System.Web.Management.FileWebEventProvider until a Server 2025 patch ships.

    I hope this helps.
    Finn

    1 person found this answer helpful.

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.