重写成员时违反了WebMarkupMin继承安全规则

时间:2017-04-10 14:35:22

标签: c# asp.net

我正在使用webmarkupmin库来最小化asp.net网站的html输出。问题是,当我在godaddy托管中发布时,我收到以下错误:

Inheritance security rules violated while overriding member: 'WebMarkupMin.Core.CodeProcessingException.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: 'WebMarkupMin.Core.CodeProcessingException.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: 'WebMarkupMin.Core.CodeProcessingException.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.]
   WebMarkupMin.Core.GenericHtmlMinifier.Minify(String content, String fileContext, Encoding encoding, Boolean generateStatistics) +0
   WebMarkupMin.Core.HtmlMinifier.Minify(String content, String fileContext, Encoding encoding, Boolean generateStatistics) +24
   WebMarkupMin.AspNet4.WebForms.Components.MinifiedComponentBase.Render(HtmlTextWriter writer, Action`1 renderHandler) +387
   WebMarkupMin.AspNet4.WebForms.MinifiedMasterPageBase.Render(HtmlTextWriter writer) +65
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +128
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +13
   System.Web.UI.Page.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +66
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1303

我已经读过我可以将此行[assembly: SecurityRules(SecurityRuleSet.Level1)]添加到a​​ssambly中,但是我没有WebMarkupMin的源代码来修改它并让它工作所以这里的问题是,你有什么想法吗?如何解决?

谢谢!

1 个答案:

答案 0 :(得分:1)

刚刚在web.config中添加了完整的信任标记

test.log.3