Global.asax 未在预编译的 Sitefinity 项目上触发
我正在尝试启动 Sitefinity 4.2 项目。作为项目的一部分,我需要在 global.asax 文件中注册一些控件,如下所示:
protected void Application_Start(object sender, EventArgs e) {
//log call
logStartUpCall(string.Concat("Application started at: ", DateTime.Now));
Telerik.Sitefinity.Abstractions.Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized);
//log call
logStartUpCall(string.Concat("Call made to bootstrapper: ", DateTime.Now));
}
protected void Application_OnStart(object sender, EventArgs e) {
//log call
logStartUpCall(string.Concat("Application started at: ", DateTime.Now));
Telerik.Sitefinity.Abstractions.Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized);
//log call
logStartUpCall(string.Concat("Call made to bootstrapper: ", DateTime.Now));
}
protected void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs args) {
//log call
logStartUpCall(string.Concat("Bootstrapper_Initialized:", " ", DateTime.Now));
//register dialogs for custom module fields
Telerik.Sitefinity.Web.UI.Dialogs.RegisterDialog<SitefinityModuleFields.Dialogs.SimpleImageSelectorDialog>();
logStartUpCall(string.Concat("Simple Image Selector dialog registered at:", " ", DateTime.Now));
Telerik.Sitefinity.Web.UI.Dialogs.RegisterDialog<SitefinityModuleFields.Dialogs.SimpleVideoSelectorDialog>();
logStartUpCall(string.Concat("Simple Video Selector dialog registered at:", " ", DateTime.Now));
Telerik.Sitefinity.Web.UI.Dialogs.RegisterDialog<ioscms.AppCode.ModuleFields.SimpleDocumentSelectorDialog>();
logStartUpCall(string.Concat("Simple Document Selector dialog registered at:", " ", DateTime.Now));
//log call
logStartUpCall(string.Concat("Dialogs registered at: ", DateTime.Now));
}
protected void logStartUpCall(string message) {
TextWriter tw = new StreamWriter(System.Web.Hosting.HostingEnvironment.MapPath("/App_Data/SiteFinity/Logs/Startup.log"), true);
// write a line of text to the file
tw.WriteLine(message);
// close the stream
tw.Close();
}
这在正常调试模式下完美运行。我正在使用 Web 部署项目来部署该项目。这当然会预编译网站。我使用的设置是:
SingleAssembly 可更新:true DebugSymbols: false
sitefinity 的另一件事是应用程序无法预编译,因此必须删除 PrecompiledApp.config 文件。
我遇到的问题是 Application_Start (我也尝试过 Application_OnStart)从未执行,因此当然对话框从未注册。
我还尝试了“将每个单独的文件夹输出合并到其自己的程序集”选项,但无济于事。
有人有什么想法吗?
提前致谢 希格斯
I'm trying to launch a Sitefinity 4.2 project. As part of the project I need to register some controls within the global.asax file, like so:
protected void Application_Start(object sender, EventArgs e) {
//log call
logStartUpCall(string.Concat("Application started at: ", DateTime.Now));
Telerik.Sitefinity.Abstractions.Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized);
//log call
logStartUpCall(string.Concat("Call made to bootstrapper: ", DateTime.Now));
}
protected void Application_OnStart(object sender, EventArgs e) {
//log call
logStartUpCall(string.Concat("Application started at: ", DateTime.Now));
Telerik.Sitefinity.Abstractions.Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized);
//log call
logStartUpCall(string.Concat("Call made to bootstrapper: ", DateTime.Now));
}
protected void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs args) {
//log call
logStartUpCall(string.Concat("Bootstrapper_Initialized:", " ", DateTime.Now));
//register dialogs for custom module fields
Telerik.Sitefinity.Web.UI.Dialogs.RegisterDialog<SitefinityModuleFields.Dialogs.SimpleImageSelectorDialog>();
logStartUpCall(string.Concat("Simple Image Selector dialog registered at:", " ", DateTime.Now));
Telerik.Sitefinity.Web.UI.Dialogs.RegisterDialog<SitefinityModuleFields.Dialogs.SimpleVideoSelectorDialog>();
logStartUpCall(string.Concat("Simple Video Selector dialog registered at:", " ", DateTime.Now));
Telerik.Sitefinity.Web.UI.Dialogs.RegisterDialog<ioscms.AppCode.ModuleFields.SimpleDocumentSelectorDialog>();
logStartUpCall(string.Concat("Simple Document Selector dialog registered at:", " ", DateTime.Now));
//log call
logStartUpCall(string.Concat("Dialogs registered at: ", DateTime.Now));
}
protected void logStartUpCall(string message) {
TextWriter tw = new StreamWriter(System.Web.Hosting.HostingEnvironment.MapPath("/App_Data/SiteFinity/Logs/Startup.log"), true);
// write a line of text to the file
tw.WriteLine(message);
// close the stream
tw.Close();
}
This works perfectly in normal debug mode. I am using a Web Deployment Project to deploy the project. This of course precompiles the website. the settings I am using are:
SingleAssembly
UpdateAble: true
DebugSymbols: false
The other thing with sitefinity is that the app can't be precompiled, so the PrecompiledApp.config file has to be deleted.
The problem I'm experiencing is that the Application_Start (I've also tried Application_OnStart) is never executed, so of course the dialogs are never registered.
I've also tried the option "Merge each individual folder output to its own assembly" with no avail.
Does anyone have any ideas?
Thanks in advance
higgsy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论