【发布时间】:2017-09-13 18:57:14
【问题描述】:
将 Application Insights 添加到我的 ASP.NET 应用程序(使用 .NET 4.5.2 的标准 ASP.NET)后,我发现使用 .NET 远程处理时出现异常。例外是:
找不到程序集 'System.Diagnostics.DiagnosticSource, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
我不太明白这里发生了什么(似乎跟踪正在跨越应用程序域边界),但如果我将 System.Diagnostics.DiagnosticSource NuGet 包添加到远程服务,错误就会消失。
不幸的是,我刚刚发现在尝试使用 SqlDependency 触发缓存刷新时也遇到了这个错误。有没有办法在使用远程处理时禁用此跟踪,如果这是实际发生的情况,还是有其他方法可以解决此问题?
服务器堆栈跟踪: 在 System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly() 在 System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo 组件信息,字符串名称) 在 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 ) 在 System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped 记录) 在 System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum) 在 System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run() 在 System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler 处理程序,__BinaryParser serParser,布尔 fCheck,布尔 isCrossAppDomain,IMethodCallMessage methodCallMessage) 在 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(流序列化流,HeaderHandler 处理程序,布尔 fCheck,布尔 isCrossAppDomain,IMethodCallMessage methodCallMessage) 在 System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm) 在 System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage.FixupForNewAppDomain() 在 System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(字节 [] reqStmBuff,SmuggledMethodCallMessage smuggledMcm,SmuggledMethodReturnMessage& smuggledMrm) 在 System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatchCallback(Object[] args) 在 [0] 处重新抛出异常: 在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg) 在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,Int32 类型) 在 System._AppDomain.CreateInstance(字符串组件名称,字符串类型名称) 在 System.Data.SqlClient.SqlDependency.CreateProcessDispatcher(_AppDomain masterDomain) 在 System.Data.SqlClient.SqlDependency.ObtainProcessDispatcher() 在 System.Data.SqlClient.SqlDependency.Start(String connectionString, String queue, Boolean useDefaults)
【问题讨论】:
-
这里有同样的问题。似乎 Application Insights 将此程序集的某些内容附加到了消息中。
标签: remoting azure-application-insights .net-remoting