Here I'll explain my successful playing with nginx, fastcgi mono server and asp.net on Windows XP operating system bringing closer development environment for .NET web applications that need to be deployed under Linux/Mono . First step by step explanation of each term and why is chosen.
Operating System
Microsoft Windows XP SP3. You will get the point why in next component :) .
nginx web server
Why nginx ?
Nginx is one of a handful of servers written to address the C10K problem. Unlike traditional servers, Nginx doesn't rely on threads to handle requests. Instead it uses a much more scalable event-driven (asynchronous) architecture. This architecture uses small, but most importantly, predictable amounts of memory under load.
Even if you don't expect to handle thousands of simultaneous requests, you can still benefit from Nginx's high-performance and small memory footprint. Nginx scales in all directions: from the smallest VPS all the way up to clusters of servers.
And YES there is nginx for windows http://nginx.org/en/docs/windows.html :). There says :
The cache and other modules requires a shared memory support do not work in Windows Vista and later due to address space layout randomization enabled in these Windows versions. - That's why OS chose is Windows XP :) .
You can download from : http://nginx.org/en/download.html .
Mono
http://www.go-mono.com/mono-downloads/download.html I'll use fastcgi-mono-server for running asp.net pages and delivering content to web server-nginx.
.NET Framework 3.5 and VisualStudio Express edition 2008
http://www.microsoft.com/express/Downloads/Download-2008.aspx
Installation of each component after download ( excluding windows XP :D )
nginx installation
Under C: ( or another location ) create nginx folder. Point CMD to c:/nginx and start nginx with the following command. Make sure port 80 is free ( Skype or another web server running ) !
start nginx.exe
Tp make sure nginx is started type
tasklist /fi "imagename eq nginx.exe"
Check if nginx works - point your web browser to : http://localhost/ and you will see :

and to close the server
nginx -s stop

Setting nginx FastCGI Pass :)
Go to c:/nginx./conf and open nginx.conf. Under server section add the following code :

then start again nginx server and check the error log.
Install Mono and start Fast CGI Mono server
First create folder where you will store .net applications. Under C:\ create fastcgiapps folder :) . Under folder create test dir and insert in it one sample .aspx file.

After downloading Mono for Windows Install it. Procedure : Next, Next, Accept, Yes ... Finish :D. I have installed Mono under C:\Program Files ...
Now open CMD and go to "cd C:\Program Files\Mono-2.6.1\bind ". There type the following command to start fastcgi-mono-server :

Now let check if this works. Point your browser to : http://localhost/slavco/index2.aspx and tadaaaaaaaammmmm :)

IT WORKS !!!
Yes it works but this was example with simple .aspx script containg html with body <b>test</b>. Now let we write one simple web site project that actually executes some C# and ASP.NET code!
Creating sample application
Open WebDeveloper express edition and create New WebSite. In my case tI use c# as PL language and my site name / project name is "WebSite4"
Add new label to the default.aspx :

After that add some action to the default.aspx.cs :)
:
Then set the project preferences ( We are using mono that means we need to use .NET Framework 2 ) :

Apply + OK. Now we need to remove some of the "old" code because will raise error during building app :)

Now we are ready to build the application :). Click build !

Lets prepare for deploying application. Under c:\fastcgiapps create new folder with the same name as your website project
Now we need to deploy/copy site to the folder. Click website -> copy website and connect to the folder we create in the step before. Copy the site contents!
Web site deployed and now we are RDY for the big moment. Point your browser to : http://localhost/WebSite4/default.aspx and we have the following :

WTF Error. OK let fix this. Go to the C:\fastcgiapps\website4 and open the web.config. Remove line 27 and save the file.

Then restart the fastcgi-mono-server. simply ctrl+c in CMD and write command again or use up button :D
.
Now let insert url again : http://localhost/WebSite4/default.aspx :

And it works like a charm :))).
what we have with the following post. we create development environment for the people who need to deploy .NET apps on linux servers without install extra machines with it. Also here I point to another most powerful web server and that is nginx. Please do not hesitate to use it. Works like a charm, it is lightweight and is very optimal as is described at the start of the article. I hope someone will find this useful. If there are some questions pls feel free to contact me via comment.
Posted
Sat, Jan 23 2010 16:58
by
slavco