Hello,

I wanted to let you know I was having all sorts of troubles getting
Rails to start reliably running on IIS6 (though I don't think IIS6 has
anything to do with it) and I had to increase the script timeout for
the very first load of the application.

I changed HttpHandler to the one i've included below.  I think the
locking is right, but has the side effect of possibly a few of the
early scripts getting a longer timeout than expected. That's probably
ok, but I'm not sure it's an "enterprise ready" solution.

What do you guys think?  Source included below.

Thanks,
Martin

--------------- begin --------------------
internal sealed class HttpHandler : IHttpHandler {

        private readonly Stopwatch _watch = new Stopwatch();
        private static bool _isFirstRequest = true; // added this

        public bool IsReusable {
            get { return true; }
        }

        public void ProcessRequest(HttpContext context) {
            lock (this) {
                if (_isFirstRequest) // added this if block
                {
                    context.Server.ScriptTimeout = 600;
                    _isFirstRequest = false;
                }

                Utils.Log("");
                Utils.Log("=== Request started at " + DateTime.Now.ToString());
                _watch.Reset();
                _watch.Start();

                Handler.IIS.Current.Handle(new Request(new
HttpRequestWrapper(context.Request)),
                                           new Response(new
HttpResponseWrapper(context.Response)));

                _watch.Stop();
                Utils.Log(">>> Request finished (" +
_watch.ElapsedMilliseconds.ToString() + "ms)");
            }
        }
    }

------------- end --------------------------
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to