Inheritance security rules violated by type..

Skip to first unread message

Robert Friberg

Jan 22, 2019, 4:03:17 PM1/22/19
Looks like I have a version mismatch somewhere.. anyone recognize the following exception or how to go about debugging?
This is on a new Azure VM running Windows Server 2016, IIS 10, .Net Framework 4.6.1
The application is an ASP.NET Mvc 5 and I added a nuget ref to 
Looking closer I can see that Elmah assembly has a dependency on System.Web 2.0 but .NET Framework 4.6.1 has 4.0

[TypeLoadException: Inheritance security rules violated by type: 'System.Net.Http.WebRequestHandler'. Derived types must either match the security accessibility of the base type or be less accessible.]
   Microsoft.Rest.ServiceClient`1.CreateRootHandler() +0
   Microsoft.Rest.ServiceClient`1..ctor(DelegatingHandler[] handlers) +59
   Elmah.Io.Client.ElmahioAPI..ctor(DelegatingHandler[] handlers) +96
   Elmah.Io.Client.ElmahioAPI..ctor(ServiceClientCredentials credentials, DelegatingHandler[] handlers) +70
   Elmah.Io.Client.ElmahioAPI.Create(String apiKey, ElmahIoOptions options) +146
   Elmah.Io.Client.ElmahioAPI.Create(String apiKey) +91
   Elmah.Io.ErrorLog..ctor(IDictionary config) +109
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +217
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1431
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +184
   System.Activator.CreateInstance(Type type, Object[] args) +34
   Elmah.ErrorLog.GetDefaultImpl(HttpContext context) +178
   Elmah.ServiceCenter.GetService(Object context, Type serviceType) +17
   Elmah.ErrorLog.GetDefault(HttpContext context) +34
   Elmah.ErrorPageBase.get_ErrorLog() +39
   Elmah.ErrorLogPage.OnLoad(EventArgs e) +400
   System.Web.UI.Control.LoadRecursive() +154
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4082

Thomas Ardal

Jan 22, 2019, 4:06:18 PM1/22/19
Hi Robert

Please contact support, by going to and contact me through the chat widget in the lower right corner. This group is for ELMAH (the open source project) in general.


Atif Aziz

Jan 22, 2019, 4:06:21 PM1/22/19
to isn't ELMAH.
You'll want to contact the folks (@elmah_io) instead.

You received this message because you are subscribed to the Google Groups "ELMAH" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit
Reply all
Reply to author
0 new messages