在站點(diǎn)Application_Start中執(zhí)行如下代碼:
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)
?
注:已經(jīng)引用Lucene.Net,程序能運(yùn)行,但是每過(guò)一段時(shí)間后會(huì)被回收(不是合法的回收,會(huì)有錯(cuò)誤)。
2 回答

繁花如伊
TA貢獻(xiàn)2012條經(jīng)驗(yàn) 獲得超12個(gè)贊
回收是因?yàn)槟愕膽?yīng)用程序池回收了,可以設(shè)置IIS 把回收時(shí)間加長(zhǎng)。序列化問(wèn)題可能是你的某個(gè)文件用了較老版本的 lucene.net 生成,然后反序列化時(shí)又用了新版本的 lucene.net ,由于 binary serialize 時(shí)會(huì)把一些版本和類的信息寫(xiě)到序列化的文件中,如果對(duì)不上,就可能失敗。
- 2 回答
- 0 關(guān)注
- 661 瀏覽
添加回答
舉報(bào)
0/150
提交
取消