Question

IIS 6.0 How to define an Application Extension Mapping for an executable (exe)

Asked by: MikeBroderick

I have Windows 2003 Server with IIS 6.0. I want to write SSI cgi #execs in shtml pages. I have been able to make one work, but I had to specify my program as the executable for the .exe mapping. This doesnt seem right. What if I want to write more that one exe on a web site:
        <p>Output from cgi: <!--#exec cgi="/cgi-bin/T1.exe" --></p>
        <p>Output from cgi: <!--#exec cgi="/cgi-bin/T2.exe" --></p>
Is there an interpreter (i.e cmd.exe) that I need to specify as the executable for the .exe mapping?

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-02-05 at 12:14:31ID23139204
Topics

Server Side Includes (SSI)

,

CGI Scripting

,

Microsoft IIS Web Server

Participating Experts
3
Points
450
Comments
19

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Using SSI and CGI for banners. Good?
    I was planning on creating an SSI webpage (SHTML) which will make a call to my BANNER.CGI to insert the appropriate banner image and hyperlink. It will do this with the SSI command: <!--#exec CGI="/cgi-bin/banner.cgi --> Result after the SHTML page has been parsed ...
  2. SSI + SHTML
    Hi I have a very weird Problem .. I am trying to run some SHTML Pages I went to the IIS and clicked on the App Mapping thing and inserted the 3 Mappings SHTML on C:\WINNT\system32\inetsrv\ssinc.dll SHTM on C:\WINNT\system32\inetsrv\ssinc.dll STM on C:\WINNT\system32\inet...
  3. <!--#exec cgi="/cgi-bin/ sunmoon.cgi-->
    I'm trying to execute a cgi scripyt from within a HTML doc. I have the line <!--#exec cgi="/cgi-bin/sunmoon.cgi--> in the doc, but the output is as if the line wasn't there - I've renamed my HTML doc as .shtml - I've uncommented the following lines from the h...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: meverestPosted on 2008-02-06 at 03:08:44ID: 20830985

Hello,

there is no mapping for executable files.  In order to make it work, you need to:

a) make sure that the web interactive user (e.g. IUSR_<computername>) has appropriate read/execute rights to the executable and directory,
b) enable execute permissions to include 'scripts and executables' - web site properties->home directory->execute permissions
c) add a new 'web service extension' enabling the .exe file/s to run.

Cheers.

 

by: MikeBroderickPosted on 2008-02-06 at 08:08:02ID: 20833121

OK, thanks. I added a new extension called .exe, and added T1,exe and T2.exe, and made sure it was set to allowed.
When I do this and load the test page, I get:

Output from cgi: Unhandled Exception: System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

For testing, my test page has 2 ssi execs, one with t1.exe and the other with t2.exe. One program should output  Hello, World, the other Hello, World 2. Instead, I get the above error twice, each after about a 20 second delay.

When I leave the mapping in (.exe --> T1.exe), it prints out t1.exe's output correctly, even when I specify #exec cgi="t2.exe" in my webpage.

Any ideas?

 

by: meverestPosted on 2008-02-06 at 13:25:42ID: 20835909

are these executables cgi compliant?  (i.e. do they get input variables from ENV and output to stdio?)

Cheers.

 

by: MikeBroderickPosted on 2008-02-06 at 13:30:01ID: 20835951

Yes (Currently they get no env variables but they put to stdout). The test pgms are maddeningly simple:

    Function Main(ByVal args As String()) As Integer
        Console.WriteLine("Content-type: text/html")
        Console.WriteLine("")
        Console.WriteLine("Hello, world!")
        Return 0
    End Function

 

by: meverestPosted on 2008-02-06 at 13:39:04ID: 20836014

Hi,

I don't reckon that adding script maps will do you much good - it's not supposed to work like that.  What that does is when you try to access and exe, it will run the script map executable with the actual accessed file as an argument.  Perhaps that is what the error is telling you?

Do these executables work OK from the cmd shell?  Normally you will access them directly, like http://localhost/t1.exe

Cheers.

 

by: MikeBroderickPosted on 2008-02-06 at 13:51:08ID: 20836111

When I run it i get the same error:

Unhandled Exception: System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

Just for grins, I added a Mapping (Home dir, configure...) to map .exe to T1.exe. It worked. However, if I specify //localhost/cgi-bin/t2.exe, it runs t1.exe, per the mapping. The point is, no parm errors.

 

by: meverestPosted on 2008-02-06 at 14:00:46ID: 20836196

Hello,

OK, so the mapping is doing exactly what I expected - running the script mapped interpreter with the actual access file as data.  From that behaviour, I assume that the file is not passed as stdin argument, but made available by some other mechanism.

This could be a permissions access thing, since the script map will run under a different user (worker process) as the  executable (anonymous user)

Try (temporarily) setting your anonymous user to administrator to see whether than makes any difference.

Cheers.

 

by: MikeBroderickPosted on 2008-02-06 at 14:16:55ID: 20836320

I added Administrators to IUSR_<myserver>. Same error.

I wonder if we need to specify an interpreter in the mappings. I actually tried a few, the same for the asp extension. Didnt work. I also tried to put cmd.exe in. I get a 404 error:
Failed to execute script: Http Status Code = 404

 

by: tedbillyPosted on 2008-02-06 at 22:00:04ID: 20838581

What a minute.  Have you setup 'Application Mapping' in IIS Application settings for your SHTML files?

 

by: meverestPosted on 2008-02-07 at 02:20:40ID: 20839605

>> I added Administrators to IUSR_<myserver>. Same error.

put administrator as the anonymous user - not just add IUSR to administrators group (IUSR may have deny restrcitions someplace)

>> I wonder if we need to specify an interpreter in the mappings.

no, no NO!  I said already that you do NOT need any mappings.  you MUST not use mappings - the cgi needs to run directly.

what about put a mime map in there for .exe - make it text/html

Cheers.

 

by: MikeBroderickPosted on 2008-02-07 at 05:47:42ID: 20840638

Yes, shtm and shtml are mapped to ssinc.dll (the sys came that way).

I apologize about the mappings. I brought it up for three reasons:
 - Its nice to see something sort of work after banging your head against the wall
 - it shows me that the program is probably written properly and permissions to it are ok
 - I read somewhere that to make a bat file run as a cgi, you specify cmd in the mappings. Since
   cmd.exe can start both a bat file and an exe at the command line, and since all of the other extensions
   specify some sort of interpreter, it makes sense to try a mappng.
I  understand that mappings is not the way to set this up. I do thank you for you time in this, it is really frustrating that something so simple as an ssi exec is this diffucult to set up on the windows platform.

 

by: MikeBroderickPosted on 2008-02-07 at 05:50:11ID: 20840652

Sorry, I forgot to mention: I changed the annonomous user to the administrator. Same error.

 

by: MikeBroderickPosted on 2008-02-07 at 06:32:56ID: 20840975

I changed the mime map to make .exe text/html (it was application/octet-stream). Same error,

 

by: meverestPosted on 2008-02-07 at 06:49:48ID: 20841127

>>  - Its nice to see something sort of work after banging your head against the wall

yes, but it's really more like "a little bit dead" - it doesn't work at all in reality ;-)

>>  - it shows me that the program is probably written properly and permissions to it are ok

not necessarily - as a script mapping, it takes on different security (application pool) than executable (web server context)

>>  - I read somewhere that to make a bat file run as a cgi, you specify cmd in the mappings. Since
   cmd.exe can start both a bat file and an exe at the command line, and since all of the other extensions
   specify some sort of interpreter, it makes sense to try a mappng.

but an executable runs natively - it doesn't need an interpreter.

>> it is really frustrating that something so simple as an ssi exec is this diffucult to set up on the windows platform.

beleive it or not, it *is* simple.  You only need the steps that I have described earlier on.  If it still doesn't work, then you may have screwed something up along the way from all that trial-and-error.  If you can, try it on a fresh install (if you have one available) to prove that to yourself.

Cheers.

 

by: MikeBroderickPosted on 2008-02-07 at 07:32:53ID: 20841539

We have a W/2000 server we use to store backups and nothing else. Set it up there. Worked the first time.

There was no node to to define web service extensions. I dont know the level of IIS. I assume 5.0 or earlier.

My development sys has iis 5.1. It is not "fresh" (I monkey with it all the time) but I will try it on that system also.

Thanks so far.

 

by: MikeBroderickPosted on 2008-02-07 at 10:48:41ID: 20843689

When I try to run the ssi exec on my dev computer, I get what looks like a dump of my program itself:
HTTP/1.1 200 OK Server: Microsoft-IIS/5.1 Date: Thu, 07 Feb 2008 17:04:15 GMT X-Powered-By: ASP.NET Connection: close X-AspNet-Version: 2.0.50727 Accept-Ranges: bytes Cache-Control: public Expires: Fri, 08 Feb 2008 16:45:50 GMT Last-Modified: Tue, 05 Feb 2008 17:25:39 GMT ETag: "1C8681C2047AB80:1C869A8E557E3E1" Content-Type: application/octet-stream Content-Length: 24576 MZÿÿ¸@¬º´ Í!¸LÍ!This program cannot be run in DOS mode...

 

by: ahoffmannPosted on 2008-02-10 at 10:13:04ID: 20861868

> This program cannot be run in DOS mode..
I guess this error message does not need any further explantions.

 

by: MikeBroderickPosted on 2008-02-28 at 09:18:28ID: 21005957

I opened a case with Microsoft. They had me run the following command on the server:
    caspol -s off
It worked (my page displayed hello world generated from my SSI CGI).

However, this turns off Code Access Security. First, it is temporary. When you press the enter key it is turned back on and my CGI doesnt work. Second, CAS is turned off for the whole machine. I do not know enough about CAS to feel comfortable turning it off for the whole machine.

I have tried (with MS support's help) to use the Framework config tool (I had to install the 600 meg SDK, thank you MS) to set up a machine code group and give it full permissions. We specified URL, my directory/*. No luck. MS duplicated the problem and is currently researching.

If somebody can tell me how to set the Framework 2.0 config tool to allow my CGI to execute, please direct me.

Thanks

 

by: MikeBroderickPosted on 2008-04-17 at 06:32:43ID: 21376812

MS Support narrowed the problem down to the dotnet framework 2.0, and IE 7 installed on the server. Something about security and those two factors with IIS. They are opening a request to fix it in IE 8 and have refunded my money. They have also talked me into using another method to programatically insert stuff onto a web page (aspx).

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...