Partilhar via


HOWTO: Setup a CGI EXE on IIS

Making an application that is web-aware is incredibly easy, as long as you understand the basic rules. Web Servers are generic tools which listen on port 80 (or any other port of your choosing) and then route requests to be handled by arbitrary code. For IIS, this arbitrary code include the IIS Static File Handler for static content and either ISAPI Extension DLL or CGI EXE for dynamic content.

Now, I must first warn you that running VB *anything* on the server is a bad idea because VB does not scale and cannot handle robust web server traffic. In fact, there are many other free alternatives (code freely available) to handle HTTP POST and then run arbitrary executable binary (including VB EXE), so you may want to look at that route first.

For example, there are some readily available HTTP POST Acceptors written in ASP that are easy to set up on IIS - just copy the ASP file to IIS, enable Script execution permissions, and create an HTML FORM that POSTs to the ASP file. You can modify the ASP to launch an arbitrary executable binary after finishing accepting the POST.

Question:

hello there

i ve a peculiar problem i ve been tryin to find the soln to.actually i ve made an applctn in VB.now i want it to be runnin on a server so that anthr server can make a HTTP POST to tht application.

The name of my applctn is abc.exe and the parameters i want to pass are

name(string)

no(integer).

is there a way to make exe files HTTP POSTable.

i ve been lookin for this on the net bt no success as yet.hope u ll help me in this.thanks a lot in advance.

Answer:

I presume that you want to run your VB Application on IIS such that another server can make an HTTP POST to this VB Application.

If so, then what you need to do are:

  1. Write your VB Application such that it conforms to the CGI 1.1 Specification . Basically, you pass parameters using PATH_INFO and/or QUERY_STRING, and both variables are available in the environment of a CGI EXE.
  2. Make your VB Application read data from StdIn and generate kosher HTTP Responses according to CGI specification. Basically, your CGI needs to send either a HTTP status-line or status: header, a content-type: header, and ensure that response headers are terminated by CRLF ( CHR(13) CHR(10) ).

After you have written your CGI EXE in VB, you will need to:

  1. Copy this EXE to a directory on the IIS server
  2. Make sure that a virtual directory points to the directory containing this EXE and make sure it has "Scripts and Executables" execution permissions enabled
  3. Create an HTML FORM that POSTs to this EXE as a URL (i.e. https://server/cgi-bin/VBApp.exe)

//David

Comments

  • Anonymous
    August 20, 2008
    Thanks for the interesting and informative site. That�s definitely what I�ve been looking for.,

  • Anonymous
    August 12, 2011
    Please, ansver this problem fro IIS 7 and IIS 7,5

  • Anonymous
    June 21, 2012
    The comment has been removed