Solved

Running An .EXE in ASP "Windows Server 2003"

Posted on 2004-09-15
8
848 Views
Last Modified: 2012-06-21
This used to work on XP, it doesnt work on Windows Server 2003

Page :
"<%
OPTION EXPLICIT

Page = "Start Services"
Header = "Start Cygnus IRC Services"

Dim Action
Action = "Cygnus Was <font color=red>Started</font>"
%>
<!-- #INCLUDE FILE="../Includes/Header.asp" -->
<!-- #INCLUDE FILE="../Includes/Admin.asp" -->
<!-- #INCLUDE FILE="../Includes/Add_Action.asp" -->
<%
Dim WSHShell
Set WSHShell = Server.CreateObject("WScript.Shell")
WSHShell.Run """C:\Progra~1\Cygnus~1\Start.lnk"" START" ,1,true
Set WSHShell = Nothing
%>
Services Should Now Be <b>Starting</b>
<!-- #INCLUDE FILE="../Includes/Footer.asp" -->"

Error :

ASP 500 Error
An error occurred processing the page you requested.
Please see the details below for more information.

COM Error Number -2146828281 (0x800A0007)
File Name /IRC/Admin/Cygnus/Start.asp
Line Number 16
Brief Description Out of memory


The worker process is running in my credentials (I allowed it to) but the problem still persists... I have added an extra 64mb Of RAM to the computer actually believing the error...but no still the same..
0
Comment
Question by:matthew1471
  • 4
  • 3
8 Comments
 
LVL 31

Expert Comment

by:alorentz
ID: 12064961
Try to run notepad instead, and see if it works.  Problem may be with the .lnk file
0
 
LVL 4

Expert Comment

by:itcnbwise
ID: 12065648
You have to use VB.NET on Windows 2003 Now:

<%@ page language="vb" %>
<%@ import namespace="System.IO" %>
<%@ import namespace="System.Diagnostics" %>

<script language="vb" runat="server" >

Public Sub page_load(s as object,e as eventargs)
      '### START PROCESS
      Dim myProcess As Process = New Process
            
      '### CHECK FOR FILE TYPES
      myProcess.StartInfo.FileName = "C:\Windows\notepad.exe"
      myProcess.StartInfo.Arguments = "myfile.txt"

      myProcess.StartInfo.UseShellExecute = False
      myProcess.StartInfo.CreateNoWindow = False
      myProcess.StartInfo.RedirectStandardError = True
      myProcess.StartInfo.RedirectStandardOutput = True

      myProcess.Start()
                  
      Dim sOut As StreamReader = myProcess.StandardOutput
      Dim outStr As String = sOut.ReadToEnd()
      Response.Write("<h4>OUTPUT: " & outStr & "</h4>")
                  
      '### READ STD ERR
      Dim sErr As StreamReader = myProcess.StandardError
      Dim outErr As String = sErr.ReadToEnd()
      Response.Write("<h4>ERROR: " & outErr & "</h4>")
            
      myProcess.WaitForExit()

End Sub

</script>

Call this script exe.aspx and run it via your browser.  It will appear to do nothing - but look in your task manager for notepad.exe, you'll see it in there running under Network Service.  Close it, and this aspx file will end.  I'm not sure what you want to do with your EXE file, but if it closes itself, this will be the script for you.

If you need to close the running EXE from the file, you can use myProcess.Close() instead of myProcess.WaitForExit() after the program has done whatever it needs to do.
0
 
LVL 3

Author Comment

by:matthew1471
ID: 12066878
My Cygnus stays running for the entire duration of the computer being on (Untill I run Cygnus_stop.asp) it runs IRC Services for Unreal..

I really really really do not wish to use .NET as there are over 26 pages based in classic ASP.. I would much prefer to fix the original problem rather than use a new programming enviroment and install a 26Mb .NET Redistributable package...

Thanks for commenting though :$

I tried running notepad instead, and ended up with a very warped graphics mess up... The titlebar... the icon... and a 1mm by 20mm Width regtangle white space box..

I looked for an update to Windows Scripting....none exists for Windows 2003
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 4

Accepted Solution

by:
itcnbwise earned 500 total points
ID: 12067044
I know there's no update for windows scripting - it's all different in Windows 2003.  Unfortunately, you'll never be able to run everything the same way you did on 2000.  I've had the same problem, and we spent weeks trying to get it to run without dot net.  In 2003, they changed the way services executed from the web account run.  Trust me, read all about it.

The good news?  Classic asp works great on dot net - no problem there.  But forget about windows scripting, Microsoft has changed the way it runs.

Also, read more about dot net - in a web environment, there is NO client-side install - you do not need a Redistributable package.  ASP.NET is just the new ASP - works exactly the same way ASP did as far as it runs on the server with no client download, with some improvements (and some disadvantages).

Trust me, you can spend weeks researching this like we did, or just accept the fact that Microsoft is trying to pigeon-hole you into upgrading.  ASP is no longer supported, and they are pushing dot net.
0
 
LVL 3

Author Comment

by:matthew1471
ID: 12067222
I still need to install the .NET redistributable on the server was what I meant....

I'll give it a few days for someone to suggest any other ideas, otherwise I guess i'll accept yours as being the answer, Windows Server 2003 does not like Windows Scripting Host...

It's a shame, I find .NET code generally longer and making less sense than classic ASP, also now there's that extra area of vulnerabilities on my server with running yet another process...

Sorry itcnbwise if my comments seem harsh, You seem to know what your on about :)
0
 
LVL 3

Author Comment

by:matthew1471
ID: 12067294
btw it wasn't running under the IUSER_ account, I ran the entire process under *my* credentials just to put an end to the possiblity that it was security issues, so "Administrator" should be able to run *anything*

but I fully believe you, Microsoft hates people who wont upgrade :P their Advertising budget on .NET must be out of this world... they *really* want people to use it
0
 
LVL 4

Expert Comment

by:itcnbwise
ID: 12067305
Hey, I hated the idea of dot net at first - I loved the ease and flexibility of vbscript.  Heck, if I wanted to code in VB I'd have made a custom DLL!  But in dot net you have to code in full VB, and using all these dot net classes.  It's a bear to learn, but once you get there, it is much cooler than ASP.

All the things we couldn't do (or needed 3rd party apps for) are done right in ASP.NET - uploading files, full email support, network functions, etc.

So I made a learning project for our programmers to learn ASP.NET - I've made the project a free downloadable open source forum program, get it here: http://forum.itcn.com/
It's programmed in VB.NET for ASP.NET, with simple, easy-to-understand functions.  Hopefully it will help you learn .net if you go that route.

And if by some miracle you discover a way to make that classic code work on 2003 - by all means, post it here!

Best of luck,
bwise
0
 
LVL 3

Author Comment

by:matthew1471
ID: 12488257
:) I'm awarding it in the experts exchange approved category "It cant be done," thank you for posting the ASP.Net Solution I shall have to try it :)

Raises my paranoia on a .Net conspiracy... I'll now have a half ASP half .NET web app...

I should have just accepted even a Server component wouldnt work :P would have saved me a few hours

sorry for doubting you and thanks for the .NET code :)
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question