[Mono-list] Newbie question - not sure which path to take

Daniel Lo Nigro lists at dan.cx
Sat Oct 20 06:23:10 UTC 2012


For serving images over the internet, using ASP.NET might be best. You can
create an ASP.NET website in Visual Studio 2010 (from the "empty"
template), reference the image generation library in it, and then deploy
this to your Linux server. How I would approach this is to make an
ASP.NETwebsite with a handler that generates and serves the images.
The code would
look something like this, in a file called something like
"GenerateImage.ashx" (using an .ashx extension is easiest):

<%@ WebHandler Language="C#" Class="MySite.GenerateImage" %>

using System;
using System.Web;

namespace MySite
{
public class GenerateImage : IHttpHandler
{
public void ProcessRequest (HttpContext context)
{
// Put code to generate your image here
 // Output the image
context.Response.ContentType = "image/png";
context.Response.BinaryWrite(data);
}

public bool IsReusable
{
get { return false; }
}
}
}

Then you need to set up mod_mono <http://www.mono-project.com/Mod_mono> for
Apache or Mono FastCGI <http://mono-project.com/FastCGI> for any other
server software (Nginx, Cherokee, lighttpd, etc). Just make sure that .ashx
files go via Mono and it should work fine.

Another option is to create an executable (.exe file) and then execute this
via exec() or system() in PHP (or Perl equivalent), but this is not as
scalable. mod_mono or the Mono FastCGI scale up pretty well as load
increases, as long as you're using a modern Mono version (2.10.x is fine)

On Fri, Oct 19, 2012 at 9:25 AM, mettafort <mettafort at gmail.com> wrote:

> Hi,
>
> I currently have a windows C# assembly that generates computer graphics
> using GDI2.  I need this to run on a web server that is Linux, so my
> assumption here is that I need to convert it to mono.  If Mono is the only
> way I can get this to run, which path do I take? I need to generate image
> files basically, whcih can be served up by the main perl/php website.  So I
> just need to be able to call onto my code, I generate the image file to
> some
> location, and the website serves it up.  Sounds simple, and I hope it is
> :-)
>
> Thanks for any advice,
>
> MF.
>
>
>
> --
> View this message in context:
> http://mono.1490590.n4.nabble.com/Newbie-question-not-sure-which-path-to-take-tp4657011.html
> Sent from the Mono - General mailing list archive at Nabble.com.
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20121020/40dcdd51/attachment.html>


More information about the Mono-list mailing list