为了账号安全,请及时绑定邮箱和手机立即绑定

System.Runtime.Serialization.SerializationException Message: Unable to find assembly 'Lucene.Net

System.Runtime.Serialization.SerializationException Message: Unable to find assembly 'Lucene.Net

九州编程 2018-12-06 22:20:21
在站点Application_Start中执行如下代码: public void CheckRebuildTasks() { try { var ts = _rebuildRepository.Source.unCompleteRoots(); if (ts.Any()) { Task.Factory.StartNew(() => { int s = 30; string nameList = string.Empty; ts.ToList().ForEach( t => nameList += string.Format("{0}[{1}]", t.AppName, t.AppContentName)); _log.Info(string.Format("Sleep {0}s to continue {1}", s, nameList)); System.Threading.Thread.Sleep(30*1000); ts.ToList().ForEach(t => { var appContent = _appContentRepository.GetBy(t.AppName, t. AppContentName); this.ClearRebuild(appContent.Name, appContent.ContentType); var si = new SmartIndexer(appContent, _zzkDocumentRepository, _rebuildRepository); si.Rebuild(t); }); }).LogExceptions("CheckRebuildTasks"); } } catch(Exception exc) { _log.Error("CheckRebuildTasks", exc); } } EventLog中的信息: An unhandled exception occurred and the process was terminated. Application ID: DefaultDomain Process ID: 43644 Exception: System.Runtime.Serialization.SerializationException Message: Unable to find assembly 'Lucene.Net, Version=2.9.4.1, Culture=neutral, PublicKeyToken=85089178b9ac3181'. 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.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.AppDomain.Deserialize(Byte[] blob) at System.AppDomain.UnmarshalObject(Byte[] blob)   注:已经引用Lucene.Net,程序能运行,但是每过一段时间后会被回收(不是合法的回收,会有错误)。
查看完整描述

2 回答

?
繁花如伊

TA贡献2012条经验 获得超12个赞

回收是因为你的应用程序池回收了,可以设置IIS 把回收时间加长。序列化问题可能是你的某个文件用了较老版本的 lucene.net 生成,然后反序列化时又用了新版本的 lucene.net ,由于 binary serialize 时会把一些版本和类的信息写到序列化的文件中,如果对不上,就可能失败。

查看完整回答
反对 回复 2019-01-21
  • 2 回答
  • 0 关注
  • 556 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信