serilog-web / classic

[Discontinued] Serilog web request logging and enrichment for classic ASP.NET applications
Apache License 2.0
79 stars 32 forks source link

SerilogWeb.Classic IIS classic mode incompatibility #77

Closed jsurville closed 1 month ago

jsurville commented 3 years ago

Hello,

I am using an app that was working fine with the IIS Classic Mode until I started using Serilog and SerilogWeb.Classic for logging. Now that the application was deployed in Test environment, I get this exception :

[PlatformNotSupportedException: This operation requires IIS integrated pipeline mode..] System.Web.HttpApplication.add_LogRequest(EventHandler value) +3674928 SerilogWeb.Classic.ApplicationLifecycleModule.Init(HttpApplication application) +159 System.Web.HttpApplication.InitModulesCommon() +170 System.Web.HttpApplication.InitModules() +71 System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +824 System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +209 System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +113 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +539

Is there any issue with using SerilogWeb.Classic in IIS Classic mode ? Because I cannot change the type of mode (I can change it on local environment but in test or production environment, the IIS pools are set to Classic mode and I can't have it changed)

Thank you for helping me, Regars

Julien

tsimbalar commented 3 years ago

Hi @jsurville
It's been a while since I've had to play with IIS .

Because the logging happens as part of the "LogRequest" event of the IIS pipeline

https://github.com/serilog-web/classic/blob/f07c97a0204811161f2545bc27aeae3d721ff9da/src/SerilogWeb.Classic/Classic/ApplicationLifecycleModule.cs#L255-L258

I think this is only exposed in "Integrated mode" .

Long story short, if you can validate that your app works fine in "Integrated mode" , I guess you'd probably want to move it to Integrated mode as well in Test and Prod environments ?

My understanding is that "Classic Mode" is considered deprecated / legacy

tsimbalar commented 1 month ago

This project is no longer being maintained and we are going to archive the SerilogWeb Repositories.

see: