Click here to Skip to main content
Click here to Skip to main content

Cassini and Apache 101

By , 19 Aug 2002
 

Introduction

Cassini is a web server written in C#, you'll find more information about it at http://www.asp.net/

These simple steps gets Apache up and running with ASP.NET

  1. Download and install Apache 2.x for Windows (remember to stop IIS)
  2. Modify the http.conf file:
    # 
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_connect_module modules/mod_proxy_connect.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    LoadModule rewrite_module modules/mod_rewrite.so 
    
    # 
    ProxyPass /aspnet http://127.0.0.1:8080/ 
    ProxyPassReverse /aspnet http://127.0.0.1:8080/ 
    
  3. Create a different catalog (not the /aspnet catalog in http.conf) for your ASP.NET files and start Cassini:
    1. If you are using the cassini server included in WebMatrix
      c:\path-to-cassini\webserver.exe /port:8080 /path:"c:\path-to-asp.net-sourcefiles"
    2. or, the stand-alone Cassini server
      c:\path-to-cassini\CassiniWebServer "c:\path-to-asp.net-sourcefiles" 8080
  4. Test:
    • Cassini: http://localhost:8080/test.aspx
    • Apache: http://localhost/aspnet/test.aspx
    <!-- test.aspx -->
    <%@ Page Language="vb" %>
    <html>
    <body>
        <form runat="server">
            <asp:Calendar runat="server" />
        </form>
    </body>
    </html>
    

Ultimate test

If everything is working fine, you can move on to the 'ultimate' test, running ASP.NET Forums on Apache

  1. Do a manual installation of ASP.NET Forums (skipping step 7)
    See: http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=21470
  2. Add to http.conf (assumes the modifications above are done)
    #AspNetForums
    ProxyPass /AspNetForums http://127.0.0.1:8081/AspNetForums 
    ProxyPassReverse /AspNetForums http://127.0.0.1:8081/AspNetForums 
    #aspnet_client
    ProxyPass /aspnet_client http://127.0.0.1:8082/aspnet_client 
    ProxyPassReverse /aspnet_client http://127.0.0.1:8082/aspnet_client 
    
  3. Start 2 different Cassinis listening on port 8081 and 8082.
    c:\path-to-cassini\webserver.exe /port:8081 /path:"c:\path-to-asp.net-forums" /vpath:"/AspNetForums" <br>
    c:\path-to-cassini\webserver.exe /port:8082 /path:"E:\Program Files\ASP.NET\Client Files" /vpath:"/aspnet_client"
    

It is not the fastest solution, but everything works fine. I decided to "stress-test" it using Homer running 10 threads 5 sockets per thread in one minute, and got the following:

Page Hits TTFB* Avg. TTLB* Avg.
/AspNetForums/Default.aspx 286 1024.96 7458.23

*: TTFB = Time To First Byte, TTLP = Time To Last Byte

Bear in mind that this test was done on my Thinkpad T21 800Mhz/512 MB, which is filled with junk.

Now I am waiting for someone to write a mod_cassini

Reference

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Per S
Web Developer
Norway Norway
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionApache performancememberkavithakcross18 Nov '08 - 17:45 
Hi everyone can anybody tell me how compatible asp.net project with apache 2.2....we r planning to host website using asp.net with Apache webserver...does this works? if yes can u tell me hw can i implement it...? if no please tell me the reason and in which way it can be implemented....
 
Thanks in advance....
GeneralAnother waymemberdfer16 Dec '06 - 23:34 
http://www.ultidev.com/products/Cassini/index.htm[^]
GeneralASP.NET and APACHEsussAnonymous12 May '05 - 3:01 
I did try the cassini + apache stuff but didnt quite work so i googled for a while and found another solution to this issue.
 
Apache released a mod por the server called cli which handles asp.net pages very well. Here is the url. The documentation is very simple just add a few lines and it works.
 
http://httpd.apache.org/cli/
 
Example:
LoadModule aspdotnet_module modules/mod_aspdotnet.so
 
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj \
licx rem resources resx soap vb vbproj vsdisco webinfo
 
AliasMatch "^/(?i)aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*)" \
"C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"
 

Options FollowSymlinks
Order allow,deny
Allow from all

 

AspNetMount /app-uri "C:/path/to/app"
Alias /app-uri "C:/path/to/app"

Options FollowSymlinks Indexes Includes ExecCGI
Order allow,deny
Allow from all
DirectoryIndex default.htm default.aspx

 

ENJOY!
GeneralRe: ASP.NET and APACHEmemberlcmduck4 Nov '05 - 1:42 
I tried it, but when I try to access by IE 6.0 it shows this message error:
 
Server Error in '/expansiva' Application.
--------------------------------------------------------------------------------
 
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
 
Requested Url: /expansiva/Entrada.aspx
 

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
 
Do you know why it is happening?
 

thanks...
 
Lucas
GeneralThere is another way...memberAde_V19 Jan '05 - 12:51 
Get the Apache CLI library. It's only for Apache2, but it allows Apache to serve .NET content, without relying on Cassini in the background.
 
Read about it here: http://incubator.apache.org/projects/httpd-cli.html
 
Download it here: http://httpd.apache.org/cli/
 
Cheers,
Ade.
GeneralThink mod_monomemberNeo4E656F29 Oct '04 - 16:36 
The fantastic guys at the Mono project have alraedy created a module for apache you can find it here:
 
http://www.go-mono.com/asp-net.html[^]
 
If you wanted to you could easily recompile it for Microsoft .NET instead of Mono if there is any need to, but I imagine if you are using apache you'd almost preffer to use mono as your .NET provider.

GeneralRe: Think mod_monomemberBrian Delahunty16 Feb '05 - 1:33 
The mono module for Apache doesn't work with Apache on windows.
 
Regards,
Brian Dela Smile | :)
 
Now Bloging![^]
GeneralDoesn't work for mesussAndre S.5 May '04 - 14:28 
I got a naked XP Pro System w/ Xampp. No Firewalls and no other software running.
 
I didn't make Cassini run on any port. No matter which port I use, Cassini tells me that this port is used by another server.
 
Any ideas?
GeneralRe: Doesn't work for mememberEron Zebadua27 May '04 - 10:47 
your should add the cassini.dll to the global assembly
 
c:\cassini\gacutil / i cassini.dll
GeneralRe: Doesn't work for mesussGeorge Dyke7 Jun '04 - 15:13 
I am trying to run Apache 2.0 on Win XP Home + Cassini for ASP.NET pages.
 
At step (3) in the basic instructions on this page, I get a similar message to the one described at the beginning of this post:
 
<<
Cassini Managed Web Server failed to start listening on port 8080.
Possible conflict with another Web Server on the same port.
>>
 
Any idea if this is the same issue? If so, what does it mean to add the cassini.dll to the global assembly? Is the global assembly like the Windows path? Or something else entirely?
 
Thanks,
George

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 20 Aug 2002
Article Copyright 2002 by Per S
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid