Brian Nickel’s Online Journal

If you don’t C# you’ll B♭

FastCGI ASP.NET Server Status Report 9

Posted by Brian on July 27, 2007

This is a status report for the week of July 23 – July 27. The major highlight of the week is the addition of autotools to SVN and a patch to System.Net.Sockets.Socket.

THIS WEEK’S ACCOMPLISHMENTS

The first accomplishment is the incorporation of autotools. You can now install the server using the standard methods. It does not yet install assemblies into the GAC, but I plan on adding that by next week.

svn co http://mono-soc-2007.googlecode.com/svn/trunk/brian/FastCgi/ fastcgi-mono-server
cd fastcgi-mono-server
./autogen.sh && make && sudo make install

Once installed, you can use either of the following, for the 1.1 or 2.0 framework respectively:

fastcgi-mono-server /socket=tcp:1234
- or -
fastcgi-mono-server2 /socket=tcp:1234

Then use the methods discussed in previous reports to add support to the webserver. (Lighttpd, Cherokee)

The second accomplishment is a patch to the mono class library for System.Net.Sockets.Socket <http://mono-soc-2007.googlecode.com/svn/trunk/brian/patches/System.Net.Sockets.Socket-endpoint.diff>. It is a precursor to a constructor that will make a wrapper from the unmanaged to the managed socket.

PLANS FOR THE COMING WEEK

I’m going to continue working on what I’ve been working on but have not completed this week:

  1. I’m going to work with my mentor to develop a plan for a control panel and additional auto-configuration.
  2. I’m going to work with the mono developers on “the socket issue”.
  3. I’m going to contact developers of various FastCGI implementations on servers to overcome various issues I’ve encountered.

CHALLENGES I’M FACING

Nothing major at the moment.

RESOURCES USED THIS WEEK

  • MSDN and SharpDevelop (Windows) – Studying and testing out the Windows implementation of System.Net.Sockets.Socket.
  • http://www.koders.com – Searching for information on WinSock2
  • various source packages – How to do things with autotools.

Sincerely,
Brian Nickel

10 Responses to “FastCGI ASP.NET Server Status Report 9”

  1. Hi Brian,

    *GREAT* project you’ve got going on here. Thanks for all of your hard work!

    Quick question: I’m running into an issue when attempting to access HttpContext.Current.Request.Url,

    > Invalid URI: The hostname could not be parsed.

    Is this a known issue?

  2. I’m trying to use cherokee with your fastcgi-mono-server (FMS) but it fails. I tried lighttpd and fails too.

    It seems that FMS does not respond to anything.

    It’s in MONO 1.2.3.1

  3. Brian said

    David,

    I actually have not encountered that problem, I did a quick test on my computer and it came out exactly as expected. Could you send me the full exception output, plus the URL of the page?

    Pedro,

    Can you show me what configurations your using and what command line arguments you used? I have a new guideline for Lighttpd temporarily hosted here: http://www.public.asu.edu/~bnickel/fastcgi-mono-server/linux/lighttpd.html

    You can post here or contact me at brian.nickel@gmail.com.

    Thanks,
    Brian

  4. I used this lines in Cherokke for sites-available/default:

    Extension aspx {
    Handler fcgi {
    Server localhost:1234 {
    Interpreter “/var/tmp/fms/bin/fastcgi-mono-server /socket=tcp:1234″
    }
    }
    }

    I’ve got fastcgi-mono-server with prefix=/var/tmp/fms.

    ¿Is it right?

  5. I posted a comment but it seems to be clasified as Spam.

    It had a few lines of a configuration file I used with Cherokee. It doesn’t work.

    Can you post the versions of cheroke, mono and fastcgi-mono-server you used for your testings?

  6. Brian said

    Hi Pedro,

    It ends up there’s as a bug in the FastCGI processing in the Cherokee 0.5.6 release which prevent my requests from being completed when there’s no POST data. I could add a hack to get around it, but I’m not quite ready to do that.

    The 0.6 releases are fixed, however. You can get my configuration here: http://www.public.asu.edu/~bnickel/fastcgi-mono-server/linux/cherokee.html

  7. Great Work!

    Thank you for your effort.

    I tried with Cherokee 0.6 and it works as expected. I’ll do more tests later.

    (NOTE: You should change Lighttpd by Cherokee at the end of the page).

  8. [...] Flickr Photos More Photos « FastCGI ASP.NET Server Status Report 9 [...]

  9. @Brian,

    I actually have not encountered that problem, I did a quick test on my computer and it came out exactly as expected. Could you send me the full exception output, plus the URL of the page?

    I rewrote the implementation to FileInfo,FullName which fixed the problem, but its probably worth investigating none-the-less. The updated code base (using FileInfo,FullName) is @ http://extf.googlecode.com/svn/trunk/Xameleon/Transform/Context.cs and the problem itself was occurring when Transform.Context was being instantiated by the line,

    Context context = new Context(HttpContext.Current, _hashAlgorithm, (string)Application["hashkey"], fileInfo, (Hashtable)xsltParams.Clone(), fileInfo.LastWriteTimeUtc, fileInfo.Length);

    … in http://extf.googlecode.com/svn/trunk/WebApp/Global.asax

    Tomorrow morning I will create a branch that uses the code from before that was causing the problem and set-up a server instance that runs against that code to highlight the issue at hand. Will update this thread accordingly.

    Thanks in advance for your help!

  10. Hey Brian,

    Just getting back to my home office after a long day away, so am just getting to this. Here’s the ASP.NET source error and stack trace,


    Invalid URI: The hostname could not be parsed.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.UriFormatException: Invalid URI: The hostname could not be parsed.

    Source Error:

    Line 35: public Context(HttpContext context, HashAlgorithm algorithm, String key, FileInfo fileInfo, Hashtable xsltParams, params object[] eTagArray)
    Line 36: {
    Line 37: _requestUri = HttpContext.Current.Request.Url.ToString();
    Line 38: _requestXmlFileInfo = fileInfo;
    Line 39: _xsltParams = xsltParams;

    Source File: C:\Documents and Settings\M. David\My Documents\Projects\extf.trunk\Xameleon\Transform\Context.cs Line: 37

    Stack Trace:

    [UriFormatException: Invalid URI: The hostname could not be parsed.]
    System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) +227
    System.Uri..ctor(String uriString) +14
    System.Web.HttpRequest.get_Url() +499
    Xameleon.Transform.Context..ctor(HttpContext context, HashAlgorithm algorithm, String key, FileInfo fileInfo, Hashtable xsltParams, Object[] eTagArray) in C:\Documents and Settings\M. David\My Documents\Projects\extf.trunk\Xameleon\Transform\Context.cs:37
    ASP.global_asax.Application_BeginRequest(Object sender, EventArgs e) in c:\Documents and Settings\M. David\My Documents\Projects\extf.trunk\WebApp\Global.asax:134
    System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +138
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +65

    I’ve created a branch @ http://extf.googlecode.com/svn/branches/mono-fastcgi-compatibility-test/ of which the code in question is _requestUri = HttpContext.Current.Request.Url.ToString(); in http://extf.googlecode.com/svn/branches/mono-fastcgi-compatibility-test/Xameleon/Transform/Context.cs

    If you check out just the http://extf.googlecode.com/svn/branches/mono-fastcgi-compatibility-test/WebApp/ directory you should be able to repro the bug via fastcgi-mono-server2 /address=127.0.0.1 /socket=tcp:1234 /maxconns=1024 /maxreqs=1024 /applications=/:. from inside that same directory. Also, the code that triggers the call to Transform.Context is Context context = new Context(HttpContext.Current, _hashAlgorithm, (string)Application["hashkey"], fileInfo, (Hashtable)xsltParams.Clone(), fileInfo.LastWriteTimeUtc, fileInfo.Length); inside of the http://extf.googlecode.com/svn/branches/mono-fastcgi-compatibility-test/WebApp/Global.asax file.

    Let me know if you have any questions. Please feel free to contact me @ m.david AT xmlhacker DOT com. Otherwise I’ll keep checking back over the next few days to see if you were able to first repro and then locate the issue at hand.

    Thanks in advance!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>