1
Vote

Asp.Net 4.6 breaks Unhanded Exception Module due to version number of webengine.dll

description

An Asp.Net application that uses the unhanded exception module on a server with ASP.Net 4.6 installed cannot run.

Error when app pool running as a user without admin permissions:

Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.

Error when app pool run with sufficient permission to the event log:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: There is no EventLog source named 'ASP.NET 4.6.81.0'. This module requires .NET Framework 2.0.

Reason:

UnhandledExceptionModule.cs (about line 43 depending on formatting)
FileVersionInfo ver = FileVersionInfo.GetVersionInfo(webenginePath);
                        _sourceName = string.Format(CultureInfo.InvariantCulture, "ASP.NET {0}.{1}.{2}.0",
                                                    ver.FileMajorPart, ver.FileMinorPart, ver.FileBuildPart);
The code is reading file version info for file located C:\Windows\Microsoft.NET\Framework\v4.0.30319\webengine.dll

Prior to 4.6 this dll's version would match the CLR version so with ASP.Net 4.5.1 this files version would be 4.0.30319. It's looking for an event log source matching the version of the file which does not exist for 4.6.

We think the code should be updated to use the System.Environment.Version rather than the file version.
My colleague has written this up in more detail on this stack overflow, please refer to that for more detail.

Stack overflow answer written by CarlR

comments

reidca wrote Dec 4, 2015 at 4:59 PM

This item has a patch available for download here: https://unhandledexception.codeplex.com/SourceControl/list/patches