WCF 应用程序“无法找到程序集”对于 SQLite

发布于 2024-09-25 17:02:58 字数 1983 浏览 0 评论 0原文

注意:这是一个已解决的问题,但我只花了4个小时在这个问题上,所以我想分享解决方案。


当我尝试访问 WCF 服务时,该服务从未响应,并且事件日志显示以下内容:

发生了未处理的异常并且 进程已终止。

应用程序 ID:DefaultDomain

进程ID:3180

异常: System.Runtime.Serialization.SerializationException

消息:无法找到程序集 'System.Data.SQLite,版本=1.0.66.0, 文化=中立, PublicKeyToken=db937bc2d44ff139'。

堆栈跟踪:位于 System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly() 在 System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo,字符串名称)位于 System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(字符串 对象名称,String[] 成员名称, BinaryTypeEnum[] 二进制类型EnumA, 对象[]类型信息A,Int32[] 成员AssemIds、对象读取器 objectReader,Int32 objectId, BinaryAssemblyInfo 程序集信息, SizedArray (assemIdToAssemblyTable)
在 System.Runtime.Serialization.Formatters.Binary._BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped 记录)在 System.Runtime.Serialization.Formatters.Binary._BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum 二进制标题枚举)在 System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run() 在 System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler 处理程序,__BinaryParser serParser, 布尔 fCheck,布尔 isCrossAppDomain、IMethodCallMessage 方法调用消息)位于 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(流 序列化流、标头处理程序 处理程序,布尔值 fCheck,布尔值 isCrossAppDomain、IMethodCallMessage 方法调用消息)位于 System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm)在 System.AppDomain.反序列化(字节[] 斑点)在 System.AppDomain.UnmarshalObject(字节[] 斑点)


解决方案 就我而言,问题最终只是一个简单的错误数据库路径。但是,错误消息根本无法反映实际原因,所以 YMMV。

“错误的连接字符串”异常未进入事件日志的原因似乎与此知识库文章< /a>.如果连接字符串不是您的问题,那么您最好的做法可能是按照本文中的步骤操作,这将导致 IIS 将异常写入事件日志。

Note: This is a solved problem, but I just spend 4 hours at this issue, so I wanted to share the solution.


When I attempt to access a WCF service, the service never responds, and the event log shows the following:

An unhandled exception occurred and
the process was terminated.

Application ID: DefaultDomain

Process ID: 3180

Exception:
System.Runtime.Serialization.SerializationException

Message: Unable to find assembly
'System.Data.SQLite, Version=1.0.66.0,
Culture=neutral,
PublicKeyToken=db937bc2d44ff139'.

StackTrace: 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.AppDomain.Deserialize(Byte[]
blob) at
System.AppDomain.UnmarshalObject(Byte[]
blob)


Solution
In my case, the problem ended up being a simple incorrect database path. However, the error message in no way reflects the actual cause, so YMMV.

The reason the "bad connection string" exception didn't make it to the event log seems related to this KB article. If the connection string isn't your problem, then your best course may be to follow the steps in this article, which will cause IIS to write exceptions to the event log.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文