代码之家  ›  专栏  ›  技术社区  ›  EJD

不允许在此安全级别反序列化

  •  1
  • EJD  · 技术社区  · 7 年前

    下面是错误。

    Raw url: /welcome.aspx
    System.Security.SecurityException: Type System.Runtime.Remoting.ObjRef and the types derived from it (such as System.Runtime.Remoting.ObjRef) are not permitted to be deserialized at this security level.
    
    Server stack trace: 
       at System.Runtime.Serialization.FormatterServices.CheckTypeSecurity(Type t, TypeFilterLevel securityLevel)
       at System.Runtime.Serialization.Formatters.Binary.ObjectReader.CheckSecurity(ParseRecord pr)
       at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObject(ParseRecord pr)
       at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
       at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel securityLevel)
       at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)
    
    Exception rethrown at [0]: 
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.Runtime.Remoting.Activation.IActivator.Activate(IConstructionCallMessage msg)
       at System.Runtime.Remoting.Messaging.ClientContextTerminatorSink.SyncProcessMessage(IMessage reqMsg)
       at System.Runtime.Remoting.Activation.ActivationServices.Activate(RemotingProxy remProxy, IConstructionCallMessage ctorMsg)
       at System.Runtime.Remoting.Proxies.RemotingProxy.InternalActivate(IConstructionCallMessage ctorMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at OnSIS.Common.Utilities..ctor()
       at OnSIS.Web.Welcome..ctor()
       at ASP.welcome_aspx..ctor()
       at __ASP.FastObjectFactory_app_web_welcome_aspx_cdcab7d2_gkkoykn5.Create_ASP_welcome_aspx()
       at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
       at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
       at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
       at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    The Zone of the assembly that failed was:
    MyComputer 2017/07/17 09:43:25
    

    同样,这一切都非常好,在生产服务器和十几个测试服务器中完全相同的代码。但我们的生产支持服务器决定不再工作。我正在寻找什么可以检查可能已经在网络或应用服务器上出错,导致上述错误。

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.runtime.remoting>
        <application>
          <channels>
            <channel ref="http" useDefaultCredentials="true" port="0">
              <clientProviders>
                <formatter ref="binary" typeFilterLevel="Full" />
              </clientProviders>
            </channel>
          </channels>
          <client url="http://10.10.10.10/AppServer">
            <activated type="MyApp.Common.Utilities,MyApp.Common" />
          </client>
        </application>
      </system.runtime.remoting>
    </configuration>
    

    网络配置(APPserver)

    <?xml version="1.0"?>
    <configuration>
    <system.runtime.remoting>
        <application>
          <service>
             <activated type="MyApp.Common.Utilities,MyApp.Common"/>      
          </service>
          <channels>
            <channel ref="http"/>
            <serverProviders>
              <formatter ref="binary" typeFilterLevel="Full" />
            </serverProviders>
          </channels>
        </application>
    </system.runtime.remoting>
    </configuration>
    
    2 回复  |  直到 7 年前
        1
  •  1
  •   Andrew Timson    7 年前

    此问题是由New Relic monitoring agent的v6引起的。具体来说,一个新的DLL支持异步代码的跟踪(new Relic的代理以前不支持)。

    如果无法卸载代理或还原到早期版本,则可以删除异步包装(C:\Program Files\New Relic.NET agent\Extensions\NewRelic.Providers.CallStack.AsyncLocal.dll)。这将恢复.NET远程处理功能,但代价是New Relic无法在代码中插入异步方法。

        2
  •  1
  •   EJD    7 年前