Global.asax not firing on precompiled Sitefinity project

烂漫一生 提交于 2019-12-11 07:39:44

问题


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

来源:https://stackoverflow.com/questions/7160711/global-asax-not-firing-on-precompiled-sitefinity-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!