[Mono-aspnet-list] FastCGI & Nginx on Windows?

ericgj ericgj72 at gmail.com
Fri Jul 10 19:03:58 EDT 2009


I am struggling to get fastcgi-mono-server2 to work with nginx, on a Windows
XP box.

I have tried many things but cannot get it to work - fastcgi-mono-server2
crashes with a System.IO.FileNotFoundException. 

I suspect it may be a problem with DOS vs UNIX style directory naming
somewhere in the process.

Is there documentation of Win32 version of fastcgi-mono-server2 command-line
switches?
Are the directory names used in /applications, /appconfigdir, /appconfigfile
switches DOS-style or UNIX-style?  I have tried them both ways and neither
seems to work.

And how does fastcgi-mono-server2 expect to see directories in the
SCRIPT_FILENAME param?  Again, I've tried both ways and neither seems to
work.


This is how I am launching fastcgi-mono-server2:

"C:\Program Files\Mono-2.4.2.1\lib\mono\2.0\fastcgi-mono-server2" 
    /socket=tcp:127.0.0.1:9000 
    /loglevels=All 
    /logfile="C:\Program Files\nginx-0.8.4\logs\mono.log" 
    /root="C:\www\html\asp\test" 
    /applications=/:.
    /appconfigdir=.

And this is the relevant part of my nginx.conf file
(hard-coding the SCRIPT_FILENAME to a known file for the moment):

    server {
        listen       80;
        server_name  localhost;

        root   /www/html/;
        index  index.html index.htm index.php index.aspx default.aspx;

        # pass ASP scripts to FastCGI server listening on 127.0.0.1:9000
        location ~ \.(aspx|asmx|ashx|asax|ascx|soap|rem|axd|cs|config|dll)$
{
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_param  SCRIPT_FILENAME 
c:\\www\\html\\asp\\test\\index2.aspx;
            include        fastcgi_params;
        }
     ...
     }

The nginx error log says:

2009/07/10 18:54:16 [error] 1116#3116: *1 WSARecv() failed (10054: An
existing connection was forcibly closed by the remote host) while reading
response header from upstream, client: 127.0.0.1, server: localhost,
request: "GET /asp/test/index2.aspx HTTP/1.1", upstream:
"fastcgi://127.0.0.1:9000", host: "localhost"


The fastcgi log file outputs the following.   

[2009-07-10 18:53:35Z] Debug   fastcgi-mono-server2
[2009-07-10 18:53:36Z] Debug   Listening on port: 127.0.0.1
[2009-07-10 18:53:36Z] Debug   Listening on address: 9000
[2009-07-10 18:53:36Z] Debug   Root directory: C:\www\html\asp\test
[2009-07-10 18:53:36Z] Debug   Max connections: 1024
[2009-07-10 18:53:36Z] Debug   Max requests: 1024
[2009-07-10 18:53:36Z] Debug   Multiplex connections: False
[2009-07-10 18:53:45Z] Debug   Accepting an incoming connection.
[2009-07-10 18:53:45Z] Notice  Beginning to receive records on connection.
[2009-07-10 18:53:45Z] Debug   Record received. (Type: BeginRequest, ID: 1,
Length: 8)
[2009-07-10 18:53:45Z] Debug   Record received. (Type: Params, ID: 1,
Length: 812)
[2009-07-10 18:53:45Z] Debug   Record received. (Type: Params, ID: 1,
Length: 0)
[2009-07-10 18:53:45Z] Debug   Read parameter. (SCRIPT_FILENAME =
c:\www\html\asp\test\index2.aspx)
[2009-07-10 18:53:45Z] Debug   Read parameter. (QUERY_STRING = )
[2009-07-10 18:53:45Z] Debug   Read parameter. (REQUEST_METHOD = GET)
[2009-07-10 18:53:45Z] Debug   Read parameter. (CONTENT_TYPE = )
[2009-07-10 18:53:45Z] Debug   Read parameter. (CONTENT_LENGTH = )
[2009-07-10 18:53:45Z] Debug   Read parameter. (SCRIPT_NAME =
/asp/test/index2.aspx)
[2009-07-10 18:53:45Z] Debug   Read parameter. (REQUEST_URI =
/asp/test/index2.aspx)
[2009-07-10 18:53:45Z] Debug   Read parameter. (DOCUMENT_URI =
/asp/test/index2.aspx)
[2009-07-10 18:53:45Z] Debug   Read parameter. (DOCUMENT_ROOT = C:/www/html)
[2009-07-10 18:53:45Z] Debug   Read parameter. (SERVER_PROTOCOL = HTTP/1.1)
[2009-07-10 18:53:45Z] Debug   Read parameter. (GATEWAY_INTERFACE = CGI/1.1)
[2009-07-10 18:53:45Z] Debug   Read parameter. (SERVER_SOFTWARE =
nginx/0.8.4)
[2009-07-10 18:53:45Z] Debug   Read parameter. (REMOTE_ADDR = 127.0.0.1)
[2009-07-10 18:53:45Z] Debug   Read parameter. (REMOTE_PORT = 3582)
[2009-07-10 18:53:45Z] Debug   Read parameter. (SERVER_ADDR = 127.0.0.1)
[2009-07-10 18:53:45Z] Debug   Read parameter. (SERVER_PORT = 80)
[2009-07-10 18:53:45Z] Debug   Read parameter. (SERVER_NAME = localhost)
[2009-07-10 18:53:45Z] Debug   Read parameter. (HTTP_HOST = localhost)
[2009-07-10 18:53:45Z] Debug   Read parameter. (HTTP_USER_AGENT =
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11)
Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729))
[2009-07-10 18:53:45Z] Debug   Read parameter. (HTTP_ACCEPT =
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8)
[2009-07-10 18:53:45Z] Debug   Read parameter. (HTTP_ACCEPT_LANGUAGE =
en-us,en;q=0.5)
[2009-07-10 18:53:45Z] Debug   Read parameter. (HTTP_ACCEPT_ENCODING =
gzip,deflate)
[2009-07-10 18:53:45Z] Debug   Read parameter. (HTTP_ACCEPT_CHARSET =
ISO-8859-1,utf-8;q=0.7,*;q=0.7)
[2009-07-10 18:53:45Z] Debug   Read parameter. (HTTP_KEEP_ALIVE = 300)
[2009-07-10 18:53:45Z] Debug   Read parameter. (HTTP_CONNECTION =
keep-alive)
[2009-07-10 18:53:45Z] Debug   Record received. (Type: StandardInput, ID: 1,
Length: 0)


Thanks for any help.

Eric

-- 
View this message in context: http://www.nabble.com/FastCGI---Nginx-on-Windows--tp24435444p24435444.html
Sent from the Mono - ASP.NET mailing list archive at Nabble.com.



More information about the Mono-aspnet-list mailing list