I am running some initialization code in the Startup class used by SignalR. The code is called in the Configuration method (this is an ASP.Net MVC application).
The initialization code must be executed exactly once and placed in the Configuration(IAppBuilder app)Startup class method as follows:
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
I noticed that the method public void Configuration(IAppBuilder app)is called exactly twice when the application starts.
The question is why?
This is the right place to run the pre and post signalr initialization code, or if this happens elsewhere. I need to make sure that the pre and post initialization code runs exactly once.
UPDATE:
, "". , , - .
> MyWebApp.dll!MyWebApp.Startup.Configuration(Owin.IAppBuilder app) Line 45 C#
[Native to Managed Transition]
Microsoft.Owin.Host.SystemWeb.dll!Owin.Loader.DefaultLoader.MakeDelegate.AnonymousMethod__b(Owin.IAppBuilder builder) Unknown
Microsoft.Owin.Host.SystemWeb.dll!Owin.Loader.DefaultLoader.LoadImplementation.AnonymousMethod__0(Owin.IAppBuilder builder) Unknown
Microsoft.Owin.Host.SystemWeb.dll!Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint.AnonymousMethod__0(Owin.IAppBuilder builder) Unknown
Microsoft.Owin.Host.SystemWeb.dll!Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(System.Action<Owin.IAppBuilder> startup) Unknown
Microsoft.Owin.Host.SystemWeb.dll!Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(System.Action<Owin.IAppBuilder> startup) Unknown
Microsoft.Owin.Host.SystemWeb.dll!Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() Unknown
mscorlib.dll!System.Threading.LazyInitializer.EnsureInitializedCore<System.__Canon>(ref System.__Canon target, ref bool initialized, ref object syncLock, System.Func<System.__Canon> valueFactory) Unknown
mscorlib.dll!System.Threading.LazyInitializer.EnsureInitialized<Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineBlueprint>(ref Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineBlueprint target, ref bool initialized, ref object syncLock, System.Func<Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineBlueprint> valueFactory) Unknown
Microsoft.Owin.Host.SystemWeb.dll!Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(System.Web.HttpApplication context) Unknown
System.Web.dll!System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(System.IntPtr appContext, System.Web.HttpContext context, System.Reflection.MethodInfo[] handlers) Unknown
System.Web.dll!System.Web.HttpApplication.InitSpecial(System.Web.HttpApplicationState state, System.Reflection.MethodInfo[] handlers, System.IntPtr appContext, System.Web.HttpContext context) Unknown
System.Web.dll!System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(System.IntPtr appContext, System.Web.HttpContext context) Unknown
System.Web.dll!System.Web.Hosting.PipelineRuntime.InitializeApplication(System.IntPtr appContext) Unknown
[AppDomain Transition]