CODEDIGEST
Home » Articles
Search
 

Technologies
 

CodeDigest Navigation
 

Technology News
No News Feeds available at this time.
 

Community News
No News Feeds available at this time.
 
HOW TO host a POSIX executable on IIS 7.0?

By Rakki Muthukumar
Posted On Feb 20,2008
Article Rating:
Be first to rate
this article.
No of Comments: 1
Category: IIS
Print this article.

HOW TO host a POSIX executable on IIS 7.0?

I was working for one of our customer who wanted to host his POSIX executables over IIS 7.0 on Windows Vista. He has .dat files which were built on an UNIX environment. He wanted use them as a CGI application hosted on IIS 7.0. Here is where the power of inter-operability of Windows comes into play. Check out the below article to know more on the Inter-Operability piece of Windows - "Subsystem for UNIX-based Applications"

http://technet2.microsoft.com/windowsserver/en/library/695ac415-d314-45df-b464-4c80ddc2b3bc1033.mspx?mfr=true

Now, to execute the .dat files created from an UNIX environment, I need to add the "Subsystem for UNIX-based Applications" on my Vista. It is present as an optional windows components which you can add by the below steps:

  1. Go to run prompt (Windows Key + R) and type appwiz.cpl
  2. Click on Turn Windows features on or off
  3. Check "Subsystem for UNIX-based Applications" and click on OK

Now, the interesting piece - How to execute the executable which would generate a HTML output like below:

<HTML>

 <Title> Sample Program </Title>

 <Body>

  <H1> Hello World! </H1>

 </Body>

</HTML>

Open a command prompt and run the posix.exe which will be found in C:\WINDOWS (%WinDir%). That should give you an output similar to below:

posix: command missing

usage: posix [/u] /c <path> [<args>]

So, we need to supply arguments to the posix.exe. Below is an example of executing hello.dat with posix.exe.

posix /c hello.dat



Now, comes a question, how to do the same with IIS 7.0? IIS 7.0 is a very powerful web server and it supports CGI applications too. Below is how you would add a Script Map for the .dat files which should be executed on the posix.exe with the argument lists.

  1.    Add Script Map for .dat files
    a.    Select the Website and in Features View double click on Handler Mappings
    b.    In the right hand side Actions Pane, select “Add Script Map”
    c.    Put *.dat as the Request Path (replace .dat with the executable extension)
    d.    Put “C:\Windows\posix.exe /c “%s””
    e.    Give a name for the Script Map and click on OK

image

Now, browse the file which would be supplied as a parameter to the posix.exe and would generate the output needed.

So, here we achieved hosting a POSIX executable created in a UNIX environment, and running on Windows Vista, also hosted on web via IIS 7.0. Isn't this a beauty? Truly, it is!

Happy Learning!

 

 

Similar Articles
You can contribute to CodeDiget.Com:
Donate to CodeDigest.com
Article Feedback
Comments
I was having same issue on W3K 64bit (VPS soltuion). When I installed MailEnable (free edition) it auto installed the 64bit version (initially ME complained that I didn't have DotNet 3.5 installed so
I was having same issue on W3K 64bit (VPS soltuion). When I installed MailEnable (free edition) it auto installed the 64bit version (initially ME complained that I didn't have DotNet 3.5 installed so I installed that 1st then retried ME install which worked).ME WebMail worked just fine. But then I needed to install some 32bit ActiveX DLLs for my website (ASPUpload was one of them), and to get these working I had to run c:\inetpub\adminscripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 1This got my 32bit DLLs working fine but WebMail stopped with an error like %1 not 32bit Win app (or something like that).So I ran your soltuion (C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i -enable) and hey presto, WebMail worked again *and* my 32bit DLLs kept on working. IIS6 added (and enabled) the entry ASP.NET v2.0.50727 (32 bit) to the Web Service Extensions list. ASP.NET v2.0.5072 was already in the list (I suspect from the DotNet 3.5 install). I think I also ended up with 2 Default.aspx entries in the Document list for all my websites (I just went and deleted one or both Default.aspx entires from all my websites that didn't use aspx).This took me several days to resolve. I hope my experience (and Alex's) helps others.Cheers Alex.Regards, Mark. Sydney, Australia.