matthew1471
asked on
Running An .EXE in ASP "Windows Server 2003"
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.a sp" -->
<!-- #INCLUDE FILE="../Includes/Admin.as p" -->
<!-- #INCLUDE FILE="../Includes/Add_Acti on.asp" -->
<%
Dim WSHShell
Set WSHShell = Server.CreateObject("WScri pt.Shell")
WSHShell.Run """C:\Progra~1\Cygnus~1\St art.lnk"" START" ,1,true
Set WSHShell = Nothing
%>
Services Should Now Be <b>Starting</b>
<!-- #INCLUDE FILE="../Includes/Footer.a sp" -->"
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.as p
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..
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.a
<!-- #INCLUDE FILE="../Includes/Admin.as
<!-- #INCLUDE FILE="../Includes/Add_Acti
<%
Dim WSHShell
Set WSHShell = Server.CreateObject("WScri
WSHShell.Run """C:\Progra~1\Cygnus~1\St
Set WSHShell = Nothing
%>
Services Should Now Be <b>Starting</b>
<!-- #INCLUDE FILE="../Includes/Footer.a
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.as
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..
Try to run notepad instead, and see if it works. Problem may be with the .lnk file
You have to use VB.NET on Windows 2003 Now:
<%@ page language="vb" %>
<%@ import namespace="System.IO" %>
<%@ import namespace="System.Diagnost ics" %>
<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.FileNa me = "C:\Windows\notepad.exe"
myProcess.StartInfo.Argume nts = "myfile.txt"
myProcess.StartInfo.UseShe llExecute = False
myProcess.StartInfo.Create NoWindow = False
myProcess.StartInfo.Redire ctStandard Error = True
myProcess.StartInfo.Redire ctStandard Output = 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.
<%@ page language="vb" %>
<%@ import namespace="System.IO" %>
<%@ import namespace="System.Diagnost
<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.FileNa
myProcess.StartInfo.Argume
myProcess.StartInfo.UseShe
myProcess.StartInfo.Create
myProcess.StartInfo.Redire
myProcess.StartInfo.Redire
myProcess.Start()
Dim sOut As StreamReader = myProcess.StandardOutput
Dim outStr As String = sOut.ReadToEnd()
Response.Write("<h4>OUTPUT
'### READ STD ERR
Dim sErr As StreamReader = myProcess.StandardError
Dim outErr As String = sErr.ReadToEnd()
Response.Write("<h4>ERROR:
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.
ASKER
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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 :)
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 :)
ASKER
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
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
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
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
ASKER
:) 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 :)
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 :)