Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.Net MVC 2 on nginx/mono 2.8

I am trying to setup ASP.Net MVC 2 application on Linux environment. I've installed Ubuntu 10.10 on VirtualBox, then installed Mono 2.8 from sources. After that I have installed nginx and configure it as recommended here. Unfortunately, FastCGI shows me standard error 500 page:

No Application Found
Unable to find a matching application for request:
Host localhost:80
Port 80
Request Path /Default.aspx
Physical Path /var/www/mvc/Default.aspx

My application is located in /var/www/mvc directory. I've tried to create some stub Default.aspx file and place it in root dir of my application, but it didn't help, same error occured. Thanks.

like image 367
Victor Haydin Avatar asked Jan 02 '11 13:01

Victor Haydin


4 Answers

I've been doing some testing with this as well, using all ubuntu10.10 binaries. From what I can make from it, either nginx fails to pass the hostname of the mono server fails to receive it over the fastcgi protocol. Anyhow, the tutorial line:

 fastcgi-mono-server2 /applications=www.domain1.xyz:/:/var/www/www.domain1.xyz/ /socket=tcp:127.0.0.1:9000

doesn't work. Removing the hostname makes the thing work:

 fastcgi-mono-server2 /applications=/:/var/www/www.domain1.xyz/ /socket=tcp:127.0.0.1:9000

but this of course blocks the use of multiple virtual mono hosts.

like image 127
Jean Avatar answered Jan 08 '23 11:01

Jean


Since you are running ASP.NET MVC 2 application you should use fastcgi-mono-server4.

like image 41
yojimbo87 Avatar answered Jan 08 '23 11:01

yojimbo87


Adding following line in /etc/nginx/fastcgi_param resolves the issue for me. It also allows to use multiple virtual hosts.

fastcgi_param HTTP_HOST $host;
like image 32
Sergey Zhukov Avatar answered Jan 08 '23 09:01

Sergey Zhukov


Does your application work with xsp (xsp4 if you are using .net 4.0)? You'll want to make sure that is working before you try configuring the connection to another web server.

Does nginx know where to find mono? You most likely have a parallel install and it won't be in the default paths.

I use apache, but you may still find some of the instructions on my blog useful: http://tqcblog.com/2010/04/02/ubuntu-subversion-teamcity-mono-2-6-and-asp-net-mvc/

like image 43
Tom Clarkson Avatar answered Jan 08 '23 11:01

Tom Clarkson