FastCGI times out on POST when using HttpModules which access Request.Form collection [Answered]RSS

2 replies

Last post Jul 02, 2010 08:38 AM by lancesh

  • FastCGI times out on POST when using HttpModules which access Request.Form collection

    Jul 01, 2010 08:25 AM|lancesh|LINK

    When trying to access the HttpContext.Current.Request.Form collection from within the BeginRequest event of a custom HttpModule during a POST operation the FastCGI process seems to just hang until the timeout is reached. It looks like it's just waiting for input as FastCGI never actually crashes although IIS reports the error:

    HTTP Error 500.0 - Internal Server Error

    C:\Program Files (x86)\PHP\php-cgi.exe - The FastCGI process exceeded configured request timeout

    The project consists of a .NET form, a PHP form and a single HttpModule:

    HttpModule:

    public class Module : IHttpModule
        {
            #region IHttpModule Members

            public void Dispose()
            {
               
            }

            public void Init(HttpApplication context)
            {
                context.BeginRequest += new EventHandler(context_BeginRequest);
            }

            void context_BeginRequest(object sender, EventArgs e)
            {
                HttpContext context = HttpContext.Current;

                // CAUSES HANG...
                var form = context.Request.Form;
            }

            #endregion
        }

    PHP File:

    <?php
    $text = '';
    if(isset($_POST['text']))
    {
        $text = $_POST['text'];
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <title>Php POST</title>
        </head>
        <body>
            <form method="POST" action="<?php echo $_SERVER["REQUEST_URI"] ?>">
                <input type="text" name="text" value="<?php echo $text ?>"></input>
                <input type="submit" name="send" value="Submit" />
            </form>

            Result: <?php echo $text ?>
               
        </body>
    </html>

    I have a basic installation of:

    • Windows 7 (64bit)
    • IIS 7.5.x
    • FastCGI / PHP under IIS (using the web platform installer)

    I have also tried this on a number of other Windows 7 and Windows server machines with the same result.

    The windows event log, PHP log and IIS log all have no errors reported.

    Running a Failed Request Trace proved the most helpful, although it only really shows me that the trace times out with FASTCGI_WAITING_FOR_RESPONSE as the last event.

    I was assuming it was something to do with headers but I found it odd that no one else seems to have reported this problem as it is very easy to recreate. Any ideas as to what is causing this would be appreciated - I can provide all code and relevant trace files on request.

     

    fastCGI error iis7 fastcgi php PHP IIS7 64bit FASTCGI_WAITING_FOR_RESPONSE

  • Re: FastCGI times out on POST when using HttpModules which access Request.Form collection

    Jul 01, 2010 11:54 AM|don.raman|LINK

  • Re: FastCGI times out on POST when using HttpModules which access Request.Form collection

    Jul 02, 2010 08:38 AM|lancesh|LINK

    Thanks for your reply.

    However, the problem is not that I wan't to increase the timeout length, the problem is that every single POST request times out when using the above code (i.e. with an HttpModule which reads Form values). I am not uploading files, I am simply using an <input/> control to post a very small piece of text as a test.