Hi all, I am doing a bit of work trying to get Spring.NET (specifically the web support) running on mono. I am using 1.2.5 preview 3 of the mono runtime at the moment.
The problem is that in the spring code they attempt to check if the HttpRuntime has been fully initialised. They do this in a rather nasty fashion that will only ever work on the MS .NET runtime. The question I have for this list is: Is there a "correct" way to check if the HttpRuntime has finished it's initialisation? From this http://msdn2.microsoft.com/en-us/library/aa479328.aspx "The HttpRuntime object initializes a number of internal objects that will help carry the request out. Helper objects include the cache manager (the Cache object) and the internal file system monitor used to detect changes in the source files that form the application. The HttpRuntime creates the context for the request and fills it up with any HTTP information specific to the request. The context is represented by an instance of the HttpContext class." it looks like you could just check if the HttpContext wasn't null. Would that be a sufficient check? Thanks for any advice you can provide! James Fitzsimons PS: offending Spring.NET code here: static WebApplicationContext() { // register for ContextRegistry.Cleared event - we need to discard our cache in this case ContextRegistry.Cleared += new EventHandler(OnContextRegistryCleared); #if NET_2_0 if (HttpRuntime.AppDomainAppVirtualPath != null) // check if we're within an ASP.NET AppDomain! { // ensure HttpRuntime has been fully initialized! // this is a problem,.if ASP.NET Web Administration Application is used. This app does not fully set up the AppDomain... HttpRuntime runtime = (HttpRuntime) typeof(HttpRuntime).GetField("_theRuntime", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null); bool beforeFirstRequest = false; lock (HttpRuntime) { beforeFirstRequest = (bool) typeof(HttpRuntime).GetField("_beforeFirstRequest", BindingFlags.Instance | BindingFlags.NonPublic). GetValue(runtime); } log.Debug("BeforeFirstRequest:" + beforeFirstRequest); if (beforeFirstRequest) { try { string firstRequestPath = HttpRuntime.AppDomainAppVirtualPath.TrimEnd('/') + "/dummy.context"; log.Info("Forcing first request " + firstRequestPath); HttpRuntime.ProcessRequest( new SimpleWorkerRequest(firstRequestPath, string.Empty, new StringWriter())); log.Info("Successfully processed first request!"); } catch (Exception ex) { log.Error("Failed processing first request", ex); throw; } } } #endif } --
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
