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

找不到程序集系统。诊断。使用远程处理时的诊断源

  •  2
  • GeekSharp  · 技术社区  · 8 年前

    在我的ASP。NET应用程序(使用.NET 4.5.2的标准ASP.NET)我发现使用时出现异常。网络远程处理。例外情况是:

    我真的不明白这里发生了什么(看起来跟踪跨越了应用程序域边界),但如果我添加系统。诊断。DiagnosticSource将NuGet包发送到远程服务,错误消失。

    不幸的是,我刚刚发现在尝试使用SqlDependency触发缓存刷新时也会出现此错误。在使用远程处理时,有没有一种方法可以禁用此跟踪(如果这是实际情况),或者有没有其他方法来解决此问题?

    Server stack trace: 
       at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
       at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
       at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
       at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
       at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
       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.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm)
       at System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage.FixupForNewAppDomain()
       at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(Byte[] reqStmBuff, SmuggledMethodCallMessage smuggledMcm, SmuggledMethodReturnMessage& smuggledMrm)
       at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatchCallback(Object[] args)
    
    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._AppDomain.CreateInstance(String assemblyName, String typeName)
       at System.Data.SqlClient.SqlDependency.CreateProcessDispatcher(_AppDomain masterDomain)
       at System.Data.SqlClient.SqlDependency.ObtainProcessDispatcher()
       at System.Data.SqlClient.SqlDependency.Start(String connectionString, String queue, Boolean useDefaults)
    1 回复  |  直到 8 年前
        1
  •  2
  •   Khoa Nguyen    8 年前

    我通过升级到系统来修复它。诊断。诊断源4.5.0

    问题是Application Insights创建了系统实例。诊断。活动并将其存储在CallContext(LogicalCallContext)中。在远程调用期间,CallContext被封送到远程服务器。不幸的是,这一点。dll不存在。

    在我的情况下,更糟糕的是,远程服务器是一个运行在上的遗留应用程序。NET 2.0,复制那里的dll并没有解决问题。

    https://github.com/Microsoft/ApplicationInsights-dotnet-server/issues/613