WebActivator.PreApplicationStartMethod does not work

前端 未结 5 1217
-上瘾入骨i
-上瘾入骨i 2020-12-15 23:34
[assembly:  WebActivator.PreApplicationStartMethod(typeof(MyApp.App_Start.StructureMapMvc), \"Start\")]

namespace MyApp.App_Start
{
    public static class Structur         


        
5条回答
  •  醉话见心
    2020-12-15 23:43

    If your code is in a Web Site Project (ie, under the App_Code folder) you cannot use PreApplicationStartupMethod! You can use PostApplicationStartupMethod instead. The "Pre" method executes before global.asax *Application_Start* runs, while "Post" executes after.

    I wasted a good hour or two before I figured this out, so hopefully this will help someone else avoid that!

提交回复
热议问题