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   
GeneralRe: Doesn't work for mesussjbllama31 Oct '04 - 6:43 
I had trouble installing Cassini. I ran the build.bat from the Start-Run menu, but it didn't successfully run gacutil. Another reply had mentioned that gacutil doesn't always work, and suggested copying the cassini.dll to the c:\WINDOWS\assembly directory (this is the directory name if you are using Windows XP).
I couldn't copy/paste the file, but I was able to tag and drag it to the directory.
 
That took care of the gacutil problem.
 
The next problem I ran into was that IIS needed to not be running. It can be turned off from the Apache-Services menu. (Or, Control Panel-Administrative Tools-Internet Information Services, IIS).
 
I needed to fill in the blanks on the Cassini panel with:
Application: c:\inetpub\wwwroot
port: 8080 (port 80 didn't work for me, conflict)
Virtual Root: /
 
This worked for me, I could click on the link for the localhost and see the files I'd copied to the inetpub/wwwroot directory. I could click on an aspx file, and the aspx page did work correctly.
 
I needed to have IIS stopped, and Cassini started, to create a new project in Visual Studio.NET.
 
Unfortunately, in my attempts to get stuff working, I messed with the virtual directories and their file permissions ... now I can't get Cassini to run the aspx files anymore.
 
Anyone know how to set the permissions correctly?
 

GeneralRe: Doesn't work for mememberglusk8 Feb '05 - 10:52 
For what it's worth, we got it up and running. The trick is to run the gacutil command in the VS.NET command prompt utility to register the Cassini dll in the global assembly cache. Afterwards, everything worked fine. This whole approach is a bit of a hack, obviously. The cleaner approach is to use the Apache CLI library. If you're running a 1.3 production version, you can install 2.0 side by side and run the CLI on it.
 
Cheers,
 
GregSmile | :)
GeneralcatalogsussAnonymous17 Jul '03 - 5:19 
could you plz explain #3 in a little more detail? I'm not really familiar with Apache server yet, but I'm getting there. where exactly do I put this line:
 
c:\path-to-cassini\CassiniWebServer "c:\path-to-asp.net-sourcefiles" 8080
 
in what file?
 
-Paul
GeneralRe: catalogsussAnonymous17 Jul '03 - 5:30 
sorry for the confusion. i now understand that the line i typed in the previous post is to be typed at a command prompt, but i'm still unsure as to what "Create a different catalog (not the /aspnet catalog in http.conf) for your ASP.NET files " is asking me to do. thanks.
 
-Paul
GeneralApache and .netmemberJake Helfert23 Jan '03 - 7:00 
I recently completed an apache module that wraps asp.net and the .net framework. This allows apache to serve .aspx pages natively, w/o IIS or Cassini, etc. It works great.
 
I am wondering if there is any interest out there for such a beast.
 
Please send me an email with your opinions.
 

 
Jake Helfert
jake@helfert.cc
GeneralRe: Apache and .netmemberyamadhrama14 Apr '03 - 20:50 
hai JAke
i am using apache 1.3 on windows.
can u pls tell me how to configure apache to process asp.net applications.
 
i am not using cassini web server.
 
pls help me in configuring this
 
thanks
GeneralRe: Apache and .netmemberAlexGnauck8 Mar '04 - 4:31 
Hello,
 
im very interested at this module. is it available for download somewhere? Is the source available too?
 
Alex
GeneralRe: Apache and .netmemberarnab197414 Nov '04 - 18:53 
Hi Jake
Can u pls tell me how to run asp.net in apache 2.x.
thanks in advance
 
Arnab
GeneralRe: Apache and .netmemberdzCepheus16 Nov '04 - 13:32 
Don't you just hate when people show up, drop something like this on us, then disappear and don't answer their emails? *sigh*
 
Support your local gravity testers -- Skydive!
Generalmod_rewritememberPeter Huisman29 Dec '02 - 11:39 
suggestion: use mod_rewrite to server aspx ?!

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

Permalink | Advertise | Privacy | Mobile
Web02 | 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