0

I'm trying to get classic asp / vbscript to run a less compiler (https://github.com/duncansmart/less.js-windows). Running the exact command from a real cmd prompt on the server works fine. So it's going to be one of those permissiony type things. My server is Win2003 x86 / IIS6.

<%
' foo.asp

outpath = "c:\inetpub\wwwroot\site\less"
cmd = "c:\less.js-windows-v1.6.2\lessc.cmd"
Set Shell = server.createobject("WScript.Shell")
nodeCommand = cmd & " " & outPath & "\app.less " & outPath & "\app.css"
errCode = Shell.Run(nodeCommand, 0, True)
' errcode = 1

%>

foo.asp is running somewhere on the web server, anonymously.

cmd.exe has had iusr_server added so that it has read and execute permission.

c:\less.js-windows-v1.6.2 has had iusr_server added with read/execute as well.

I've granted everyone permission to modify files in side c:\inetpub\wwwroot\site\less to make sure it's not a permission thing.

I have tried modifying my command to include CMD /C ahead of the command file name.

6
  • Try throwing your code into a VBS file and running it on your web server, just to rule out anything code-related. Commented Mar 26, 2014 at 13:42
  • You might find this helpful How do I execute a DOS command / batch file / exe from ASP? Commented Mar 26, 2014 at 16:54
  • @Lankymart: I've tried pretty much all that already. I know it's permission related. It seems to be that I'm running a .cmd file as opposed to an exe or bat. @Bond: this works fine outside IIS. It must be permission related, but I have granted IUSR exe rights on cmd.exe and the less app and the location being written to. Commented Mar 26, 2014 at 22:06
  • @frumbert If it is permissions you should be getting some HTTP 500 Internal Server Error useless your error pages are not configured correctly for 500-100.asp. Commented Mar 26, 2014 at 22:11
  • @frumbert Hi, sorry to add to the "have you tried" list. But have you tried ShellExecute, it forces security elevation of the program. objShell.ShellExecute "cmd.exe", "/k echo test", "", "runas", 1 Commented Mar 26, 2014 at 22:32

1 Answer 1

0

Use the following process:

  • Stop the server
  • Change relative paths to full paths for all files
  • Reconfigure the IUSR to be you
  • Restart the server
Sign up to request clarification or add additional context in comments.

1 Comment

They are full paths already, including the references inside the cmd files being executed. I guess I could have configured IUSR to be me since the script runs interactively it (ps you linked to doco for iis7, not iis6). Solution seems to be create a new user with the perimissions on those items and used it in place of the anonymous user ... seems like a kludge, but then again this is IIS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.