ASP.NET pages with nginx

Hi all,
i would like to use my aspx pages with raspberry and nginx but it seem
to be
not an easy goal…
I have tried almost all “tutorials” on the web but i can not find
solution
for my issue. With lots of experiments i was able to reach a point where
i
can not move forward.

No Application Found
,Unable to find a matching application for request:
,Host bernolak.dyndns.info:8080
,Port 8080
,Request Path /Default.aspx
,Physical Path /var/www/demo/Default.aspx

I’m not sure where is the problem, is this error message(500) generated
by
nginx or mono “framework”?
Any help is highly appreciated.
Thanks, Peter

sudo apt-get install nginx
sudo apt-get install mono-complete
sudo apt-get install mono-fastcgi-server4

server {
listen 8080;
server_name bernolak.dyndns.info;
#root /var/www/demo;
access_log /var/log/nginx/bernolak.access.log;
error_log /var/log/nginx/bernolak.error.log;
location / {
root /var/www/demo;
index index.html index.htm default.aspx Default.aspx;
fastcgi_index Default.aspx;
fastcgi_pass 127.0.0.1:9000;
include /etc/nginx/fastcgi_params;
fastcgi_buffer_size 4K;
fastcgi_buffers 64 4k;
}
}

Added to /etc/nginx/fastcgi_params.
fastcgi_param PATH_INFO “”;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

Verified configuration and reload was successfull:
sudo nginx -t && sudo service nginx reload

start the mono server by running this command
sudo fastcgi-mono-server4
/applications=/bernolak.dyndns.info:8080:/:/var/www/demo/
/socket=tcp:127.0.0.1:9000 /logfile=/var/log/mono/fastcgi.log
/printlog=True
&

When i reload url i can see error No Application Found, mention above.
Multiple screenshots with this issue are here
http://www.raspberrypi.org/forum/viewtopic.php?f=66&t=68858&sid=addea653dc910687553f6957aae1add5

Posted at Nginx Forum:

On 10 February 2014 10:55, parnican [email protected] wrote:

Hi all,
i would like to use my aspx pages with raspberry and nginx but it seem to be
not an easy goal…
I have tried almost all “tutorials” on the web but i can not find solution
for my issue. With lots of experiments i was able to reach a point where i
can not move forward.

No Application Found
,Unable to find a matching application for request:
,Host bernolak.dyndns.info:8080

I suspect this is a problem ^^^^^^^^^^ - and it may be /your/ problem.
You’re obviously hitting the mono app server, so the problem is just
one of getting mono and nginx to agree on what they’re talking about.

Figure out how to make nginx not pass through the “:8080” in the
Host header, and you may find yourself further on the path to a
working setup.

HTH,
J

HI Jonathan, thanks for reply. I really apologize but i have no clue
what do
you by ^^^^^^^^^^ ?
Thank you.

Posted at Nginx Forum:

I have tried “experiments” with following parameters but no change…not
sure
this is the way i should go… Any suggestion how to make nginx not
pass
through the ":8080?

proxy_pass_request_headers off;
proxy_pass_request_body off;
proxy_redirect off;
}
}

Posted at Nginx Forum:

On 10 Feb 2014 17:12, “parnican” [email protected] wrote:

I have tried “experiments” with following parameters but no change…not
sure
this is the way i should go… Any suggestion how to make nginx not pass
through the ":8080?

How about proxy_set_header?

J

I have played with this command: sudo fastcgi-mono-server4
/applications=/bernolak.dyndns.info:8080:/:/var/www/demo/
/socket=tcp:127.0.0.1:9000 /logfile=/var/log/mono/fastcgi.log
/printlog=True
&

Is it possible that i don’t have VPath:realpath configured correctly? If
not
what is my VPath? I have there just :realpath

FATAL UNHANDLED EXCEPTION: System.ArgumentException: Should be something
like [[hostname:]port:]VPath:realpath

Posted at Nginx Forum:

On 11 Feb 2014 13:44, “parnican” [email protected] wrote:

Just did some experiments with following settings:
proxy_set_header X-Real-IP $remote_addr;
proxy_pass_header X-Accel-Redirect;

No change:( …its time to give up or any ides?

How about using it to set the header that contains the “wrong” setting -
the Host header.

#proxy_redirect off;
proxy_buffering on;
}
}

You appear to be throwing crap at a wall and seeing what sticks. I
suggest
that you do the absolutely most simple thing that you can get to work (a
Hello world mono app and nginx just passing requests through) and only
change things as you /need/ to, one at a time, so you can see what
change
breaks things.

Just my 2 cents :slight_smile:
J

Just did some experiments with following settings:
proxy_set_header X-Real-IP $remote_addr;
proxy_pass_header X-Accel-Redirect;

No change:( …its time to give up or any ides?

Also tried:
proxy_cache_bypass $cookie_nocache $arg_nocache $arg_comment;
proxy_cache_bypass $http_pragma $http_authorization;

proxy_set_header X-Real-IP $remote_addr;
proxy_pass_header X-Accel-Redirect;

#proxy_pass_request_headers off;
#proxy_pass http://localhost:9000;
#proxy_pass_request_body off;
#proxy_redirect off;
proxy_buffering on;
}
}

Posted at Nginx Forum:

You are right, now its that phase…throwing crap at a wall and seeing
what
sticks :wink:

WinForm app, better to say console app, hello world.exe is working.

Posted at Nginx Forum:

This didn’t work.
proxy_set_header Host $proxy_host;
next try
proxy_set_header Host $http_host:8080;
added #proxy_set_header Connection close; //or

location / {
root /var/www/demo;
index index.html index.htm default.aspx Default.aspx;

  proxy_set_header Host  $proxy_host;
  #proxy_set_header Connection close;

  include /etc/nginx/fastcgi_params;
  fastcgi_index Default.aspx;
  fastcgi_pass 127.0.0.1:9000;

}
}

Posted at Nginx Forum:

On 11 Feb 2014 15:09, “parnican” [email protected] wrote:

This didn’t work.
proxy_set_header Host $proxy_host;
next try
proxy_set_header Host $http_host:8080;

Tell your app to expect “bernolak.dyndns.info”, without the port suffix.

Tell nginx to set the Host header to “bernolak.dyndns.info”, without the
port suffix.

I’ll tap out at this point, however, as any further discussion is likely
to
involve mono integration and that’s not something I particularly enjoy.

J

You have all my respect!

Hello World! Got an aspx page running on nginx!!!

THANK YOU!

Posted at Nginx Forum:

Hi All,

I am also stuck trying to load aspx pages with raspberry pi and nginx.

I start the mono server with the below line:
sudo fastcgi-mono-server4 /applications=localhost:/:/home/pi/var/www/
/soket=tcp:127.0.0.1:9000

and nginx with the following:
sudo /etc/init.d/nginx start

and the output I get is


No Application Found

Unable to find a matching application for request:

Host 10.75.2.5
Port 80
Request Path /Default.aspx
Physical Path /home/pi/var/www/Default.aspx

Please find below all my files.
Could you please help me to find out what i am missing to get this
simple
page up and running?


my /etc/nginx/sites-available/default file is as follows:

server {
listen 80;
server_name localhost;

    location /{
            root /home/pi/var/www/;
            index index.html index.htm default.aspx Default.aspx;

            include /etc/nginx/fastcgi_params;
            fastcgi_index Default.aspx;
            fastcgi_pass 127.0.0.1:9000;
    }

}


my /etc/nginx/fastcgi_params:

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

fastcgi_param HTTPS $https;
fastcgi_param PATH_INFO “”;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;


my /home/pi/var/www/Default.aspx file:

Hello World!

Posted at Nginx Forum:

Hello!

On Sun, Mar 02, 2014 at 05:32:43AM -0500, pumiz wrote:

[…]

Physical Path /home/pi/var/www/Default.aspx
server {
}
fastcgi_param SCRIPT_FILENAME $request_filename;
[…]

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

In your fastcgi_params the SCRIPT_FILENAME param is set multiple
times, and at least one of the values ($request_filename) is
wrong for the configuration used.

I would recommend you to revert all the modifications to
fastcgi_params, and use

root /home/pi/var/www/;

location / {
   fastcgi_pass 127.0.0.1:9000;
   fastcgi_index Default.aspx;
   include fastcgi_params;
   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

in the configuration instead. Alternatively, use “fastcgi.conf”
as available for simple configurations, it already has
SCRIPT_FILENAME set:

root /home/pi/var/www/;

location / {
   fastcgi_pass 127.0.0.1:9000;
   fastcgi_index Default.aspx;
   include fastcgi.conf;
}


Maxim D.
http://nginx.org/