我正在尝试通过SharePoint计时器作业安排对存储在SharePoint中的页面进行CefSharp渲染。但是,在调用Cef.Initialize()之后,OWSTIMER.exe服务几乎立即崩溃,抛出没有错误。
订阅类是:
internal class Subscriptions: IDisposable
{
internal Subscriptions()
{
db = // CreateConnection();
if (Cef.IsInitialized == false)
{
var settings = new CefSettings
{
CachePath = "cache",
BrowserSubprocessPath = "ProjectBin\\CefSharp.BrowserSubprocess.exe",
LogSeverity = LogSeverity.Default,
};
Cef.Initialize(settings);
}
}
internal void RunTodaysSubscriptions()
{
var subs = db.tt_ScheduledJobs.Where(sj => sj.Date <= DateTime.Today).Select(sj => sj.tt_Subscription).ToList();
foreach (var sub in subs)
{
ExecuteSubscription(sub);
SetNextSchedule(sub);
}
}
private void ExecuteSubscription(tt_Subscription subscription)
{
tt_JobHistory historyEntry = new tt_JobHistory();
historyEntry.SubscriptionKey = subscription.SubscriptionKey;
historyEntry.StartDate = DateTime.Now;
historyEntry.Status = "In Progress";
dfe.tt_JobHistory.Add(historyEntry);
dfe.SaveChanges();
string url = //path to file
using (SubscriptionExecution se = new SubscriptionExecution(
url,
subscription.SubscriptionKey,
subscription.Format))
{
//Completed represents either a response from the dashboard that the export either succeded
//or failed. If there is no response (i.e. a javascript error preventing the dashboard from executing
//an export, then we would hit the timeout of 5 minutes and shutdown this process.
if (SpinWait.SpinUntil(() => se.Completed == true, 120000) == true)
{
//Had a response from dashboard, could be a success or failure
if (se.ServerModel.Success == true) SuccessHistoryEntry(historyEntry);
else ErrorHistoryEntry(se.ServerModel.Message, historyEntry);
}
else
{
ErrorHistoryEntry("Process timed out generating subscription", historyEntry);
}
}
db.SaveChanges();
}
// ...
}
SubscriptionExecution是:
internal class SubscriptionExecution : IDisposable
{
// ...
internal SubscriptionExecution(string url, int subscriptionId, string fileType, string logLocation)
{
LogLocation = logLocation;
SubscriptionId = subscriptionId;
FileType = fileType;
Completed = false;
ServerModel = new ServerModel();
ServerModel.PropertyChanged += new PropertyChangedEventHandler(ServerModel_PropertyChanged);
browser = new ChromiumWebBrowser(url);
browser.RegisterJsObject("serverModel", ServerModel);
browser.LoadingStateChanged += LoadingStateChanged;
if (LogLocation != string.Empty) browser.ConsoleMessage += BrowserConsoleMessage;
}
private void ServerModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "Success")
{
Completed = true;
}
}
// ...
}
有一个loadStateChange函数,它会在事件发生时注入一些修改ServerModel.Success字段的javascript。
然而,我似乎无法做到这一点。除了在一个特定情况下,timerjob到达Cef.Initialize(settings)
部分,然后立即重新启动。不幸的是,在事件日志之外,没有找到错误消息。
在Windows事件日志中,有 这表示libcef.dll中存在错误
我已为此版本的cefsharp(v57)安装了libcef.dll.pdb符号。 CefSharp故障排除指南建议在这种情况下,应该有日志文件或错误转储。应用程序文件夹中应该有一个文件'debug.log',也可能是AppData \ Local \ CrashDumps中的迷你崩溃文件。
但是,由于这是一个SharePoint计时器作业,因此这些文件似乎没有出现。我 在15个hive bin中找到了一个debug.log文件(C:\ Program Files \ Common Files \ Microsoft Shared \ Web Server Extensions \ 15 \ BIN);但是这个文件是空的。
我无法在任何地方找到CrashDumps文件夹;在计算机上的所有用户帐户下进行检查,尤其是正在运行的帐户和SharePoint计时器作业管理帐户。
我可以在不重新启动计时器作业的情况下运行代码的一个特定情况是在服务器重新启动后立即执行。重启服务器(暂时)解决了这个问题的其他一些问题,所以我怀疑它可能是相关的。也就是说,我在收回和重新部署服务器场解决方案时遇到了麻烦。这会引发一些不同的错误:
我试图使用Process Explorer找到使用icudtl.dat的其他进程,但我找到的只是chrome,它正在访问另一个副本。杀死所有镀铬工艺并再次尝试也无法解决问题。