2
votes

In my development environment, everything works fine, but when deployed to the server, I get the following error:

Inheritance security rules violated while overriding member: 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService()'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

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.TypeLoadException: Inheritance security rules violated while overriding member: 'Castle.MicroKernel.DefaultKernel.InitializeLifetimeService()'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

The strange thing is, that on another site, the same Castle version doesn't raise an error.

1
Where is the dll from which you try to load your type? It is obvious that the problem raises from the security constraints of the two .net environments. Did you try to run your app in elevated mode? Here is a discussion on relevant topic. Can you paste some code and project structure, please? - Ognyan Dimitrov
it was the Full Trust setting of the server... - Filip

1 Answers

0
votes

I had the same issue with a .net web application that runs in a shared hosting environment. The thing that sorted it out for me was requesting full trust for the domain that the application was on from the hosting company. Bear in mind that putting the full trust setting in the web config only threw an error due to the restrictions on the server.