Inheritance security rules violated while overriding member:

Inheritance security rules violated while overriding member:

Old forum URL: forums.lhotka.net/forums/t/12744.aspx


7designs posted on Tuesday, September 09, 2014

I receive this error when I deploy to a shared hosting server at godaddy. I do not get this error on localhost or deployed to development server. Any ideas?

 

Inheritance security rules violated while overriding member: 'Csla.Server.DataPortalException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. 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: 'Csla.Server.DataPortalException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[TypeLoadException: Inheritance security rules violated while overriding member: 'Csla.Server.DataPortalException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.]
   Csla.DataPortal.Fetch(Type objectType, Object criteria) +0
   Csla.DataPortal.Fetch(Object criteria) +56
   QSLDL.CountryList.GetAll() in CountryList.Generated.cs:84
   Default.LoadForm() in Default.aspx.cs:35
   Default.Page_Load(Object sender, EventArgs e) in Default.aspx.cs:21
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

RockfordLhotka replied on Tuesday, September 16, 2014

This may be because godaddy isn't running your code in a FullTrust AppDomain.

The Microsoft BinaryFormatter and NetDataContractSerializer types require FullTrust.

If you are using CSLA 4.5+ you can configure CSLA to use MobileFormatter instead. This formatter has some limitations, but if you are using managed properties and standard CSLA base classes it should just work. MobileFormatter was written for Silverlight and WinRT, and so doesn't require FullTrust.

7designs replied on Tuesday, September 16, 2014

Thanks for the reply. I found adding  <trust level="Full" /> to the web config file allows the code to run with full trust.

 

<system.web>
     <trust level="Full" />

Copyright (c) Marimer LLC