Cgi Script in C# [Answered]RSS

4 replies

Last post Mar 29, 2011 11:04 PM by chalakiblog

  • Cgi Script in C#

    Aug 26, 2008 08:48 AM|jonathanpeppers|LINK

    I have written a Cgi script in C# to translate communication to a local Window Communication Foundation (WCF) service, b/c we are having to do some integration with an existing Point of Sale system.

     My issue is that when run in a browser, the script for some reason cannot load some assemblies required for my script.  When run from the command prompt, it works just fine.  If I configure IIS to run the script under administrator, it does not work either.

     Both the IIS_IUSRS group and IUSR have proper file access to the assembly.  If I subscribe to the AssemblyResolve event, and call Assembly.LoadFrom and give a path, it works for some reason.  But then other things fail such as looking at the registry and WCF loading it's configuration files.  (Which the IIS user should have access to)

     Fusion logs give me failure to load what looks like the correct path.  Has anyone gotten a C# cgi script to work that has access to the Registry, WCF, etc.?

  • Re: Cgi Script in C#

    Aug 29, 2008 09:35 AM|jonathanpeppers|LINK

    Does anyone know how to accomplish the same thing with an asp.net page?

     I need to respond with Content-type: text/xml, with a specific xml format.

  • Re: Cgi Script in C#

    Aug 29, 2008 04:22 PM|anilr|LINK

    Response.ContentType = "text/xml";

    Response.Write("blah blah blah");

     

    Anil Ruia
    Software Design Engineer
    IIS Core Server
  • Re: Cgi Script in C#

    Sep 02, 2008 11:32 AM|jonathanpeppers|LINK

    This worked, I had to call Response.End() to prevent the default html from printing.

    Using asp.net to emulate cgi seemed much easier to set up.

  • Re: Cgi Script in C#

    Mar 29, 2011 11:04 PM|chalakiblog|LINK

    I have written two articles on this topic. Both use simple C# and no ASP.NET framework classes are used. I am including the source code and screenshots. Hope this helps. 8 easy steps to develop and setup C# CGI program in IIS 7 and Maintain HTTP session state – Set and Get Cookies in C# CGI program developed in VS2010 Express, running on IIS

    cgi c# iis vs2000

    Learn ASP.NET/C#/VB using Chalaki's ASP.NET Online Classes.