473,585 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Spawning asynchronous server-side scripts

I need to start a lengthy file copy process going on our intranet
server from a .asp page. Since the .asp cannot wait for this to
complete - it might take anything up to half an hour - I've been
trying to use wshShell.Run to start a .wsf script running on the
server itself:

ignore = wshShell.Run("% comspec% /c ""cscript " & scriptpath & " " &
arguments & """", 1, false)

This starts the script OK, and will log what it is doing to a logfile
on the server so I can see what is going on. What I cannot do is
access a UNC share.

From what I can see, if my intranet runs as a pooled thread or as its
own thread, the script gets executed in the user context of the
IWAM_machine account. If I set the intranet to run as part of IIS, it
gets executed under the SYSTEM account. Neither of these have access
to shares in the larger domain, for obvious reasons.

So, is there a better way to start a process going without having to
wait for it to finish under an account that _does_ have rights to
these shares?

I can't really map lots of network drives as there are more potential
share locations than letters in the alphabet and the locations
regularly change. I can't map temporary network drives as multiple
copies of the script may be executing at once. So that's using the
wshNetwork object out the window :(

I really don't want to have to compile an .exe to do this as keeping
everything as script files makes it much easier to maintain and
update.
Jul 19 '05 #1
5 2662
"MikeT" <ne**@chthonic. f9.co.uk> wrote in message
news:af******** *************** ***@posting.goo gle.com...
I need to start a lengthy file copy process going on our intranet
server from a .asp page. Since the .asp cannot wait for this to
complete - it might take anything up to half an hour - I've been
trying to use wshShell.Run to start a .wsf script running on the
server itself:

ignore = wshShell.Run("% comspec% /c ""cscript " & scriptpath & " " &
arguments & """", 1, false)

This starts the script OK, and will log what it is doing to a logfile
on the server so I can see what is going on. What I cannot do is
access a UNC share.

From what I can see, if my intranet runs as a pooled thread or as its
own thread, the script gets executed in the user context of the
IWAM_machine account. If I set the intranet to run as part of IIS, it
gets executed under the SYSTEM account. Neither of these have access
to shares in the larger domain, for obvious reasons.

So, is there a better way to start a process going without having to
wait for it to finish under an account that _does_ have rights to
these shares?


Make your script a script component, register it in COM+, and set it to run
with an appropriate identity so it can access the network.

http://msdn.microsoft.com/library/de...l/lettitle.asp

--
Tom Kaminski IIS MVP
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
http://mvp.support.microsoft.com/
http://www.microsoft.com/windowsserv...y/centers/iis/

Jul 19 '05 #2
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message news:<bq******* **@kcweb01.netn ews.att.com>...
"MikeT" <ne**@chthonic. f9.co.uk> wrote in message
news:af******** *************** ***@posting.goo gle.com...
I need to start a lengthy file copy process going on our intranet
server from a .asp page. Since the .asp cannot wait for this to
complete - it might take anything up to half an hour - I've been
trying to use wshShell.Run to start a .wsf script running on the
server itself:

ignore = wshShell.Run("% comspec% /c ""cscript " & scriptpath & " " &
arguments & """", 1, false)
[snip] So, is there a better way to start a process going without having to
wait for it to finish under an account that _does_ have rights to
these shares?


Make your script a script component, register it in COM+, and set it to run
with an appropriate identity so it can access the network.

http://msdn.microsoft.com/library/de...l/lettitle.asp


Thanks for that - not many changes are needed to make this a .wsc
component. Forgive me for being stupid, but how do I call this
component/write this component so that it runs the file transfer and
renaming asynchronously from the host .asp script?
Jul 19 '05 #3
"MikeT" <ne**@chthonic. f9.co.uk> wrote in message
news:af******** *************** **@posting.goog le.com...
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message news:<bq******* **@kcweb01.netn ews.att.com>...
"MikeT" <ne**@chthonic. f9.co.uk> wrote in message
news:af******** *************** ***@posting.goo gle.com...
I need to start a lengthy file copy process going on our intranet
server from a .asp page. Since the .asp cannot wait for this to
complete - it might take anything up to half an hour - I've been
trying to use wshShell.Run to start a .wsf script running on the
server itself:

ignore = wshShell.Run("% comspec% /c ""cscript " & scriptpath & " " &
arguments & """", 1, false)
[snip] So, is there a better way to start a process going without having to
wait for it to finish under an account that _does_ have rights to
these shares?


Make your script a script component, register it in COM+, and set it to run with an appropriate identity so it can access the network.

http://msdn.microsoft.com/library/de...l/lettitle.asp
Thanks for that - not many changes are needed to make this a .wsc
component. Forgive me for being stupid, but how do I call this
component/write this component so that it runs the file transfer and
renaming asynchronously from the host .asp script?


Sorry, I missed the asynchronous bit. This might help:
http://www.aspfree.com/articles/644,1/articles.aspx
Jul 19 '05 #4
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message
news:bq******** **@kcweb01.netn ews.att.com...
"MikeT" <ne**@chthonic. f9.co.uk> wrote in message
news:af******** *************** **@posting.goog le.com...
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message news:<bq******* **@kcweb01.netn ews.att.com>...
"MikeT" <ne**@chthonic. f9.co.uk> wrote in message
news:af******** *************** ***@posting.goo gle.com...
> I need to start a lengthy file copy process going on our intranet
> server from a .asp page. Since the .asp cannot wait for this to
> complete - it might take anything up to half an hour - I've been
> trying to use wshShell.Run to start a .wsf script running on the
> server itself:
>
> ignore = wshShell.Run("% comspec% /c ""cscript " & scriptpath & " " &
> arguments & """", 1, false)
>

[snip]
> So, is there a better way to start a process going without having to
> wait for it to finish under an account that _does_ have rights to
> these shares?

Make your script a script component, register it in COM+, and set it
to run with an appropriate identity so it can access the network.

http://msdn.microsoft.com/library/de...l/lettitle.asp
Thanks for that - not many changes are needed to make this a .wsc
component. Forgive me for being stupid, but how do I call this
component/write this component so that it runs the file transfer and
renaming asynchronously from the host .asp script?


Sorry, I missed the asynchronous bit. This might help:
http://www.aspfree.com/articles/644,1/articles.aspx


Here's another thought - how about using wshShell.Run to call "Soon" (or
"AT" if you don't have the ResKit), which can "schedule" your script to run
in a few seconds?

--
Tom Kaminski IIS MVP
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
http://mvp.support.microsoft.com/
http://www.microsoft.com/windowsserv...y/centers/iis/

Jul 19 '05 #5
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message news:<bq******* ***@kcweb01.net news.att.com>.. .
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message
news:bq******** **@kcweb01.netn ews.att.com...
"MikeT" <ne**@chthonic. f9.co.uk> wrote in message
news:af******** *************** **@posting.goog le.com...
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message news:<bq******* **@kcweb01.netn ews.att.com>... > "MikeT" <ne**@chthonic. f9.co.uk> wrote in message
> news:af******** *************** ***@posting.goo gle.com...
> > I need to start a lengthy file copy process going on our intranet
> > server from a .asp page. Since the .asp cannot wait for this to
> > complete - it might take anything up to half an hour - I've been
> > trying to use wshShell.Run to start a .wsf script running on the
> > server itself:
> >
> > ignore = wshShell.Run("% comspec% /c ""cscript " & scriptpath & " " &
> > arguments & """", 1, false)
> > [snip] > > So, is there a better way to start a process going without having to
> > wait for it to finish under an account that _does_ have rights to
> > these shares?
>
> Make your script a script component, register it in COM+, and set it to
run > with an appropriate identity so it can access the network.
>
>

http://msdn.microsoft.com/library/de...l/lettitle.asp

Thanks for that - not many changes are needed to make this a .wsc
component. Forgive me for being stupid, but how do I call this
component/write this component so that it runs the file transfer and
renaming asynchronously from the host .asp script?


Sorry, I missed the asynchronous bit. This might help:
http://www.aspfree.com/articles/644,1/articles.aspx


Here's another thought - how about using wshShell.Run to call "Soon" (or
"AT" if you don't have the ResKit), which can "schedule" your script to run
in a few seconds?


I'll take a look at that too, but won't that just run the script in
the same user-contexts as I experienced with wshShell.Run above?

The aspfree link looks interesting - seems a much better fit to my
problem at first glance anyway. Thanks for your help.
Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3227
by: Chris | last post by:
I have a stand-alone program that I want to convert into a client-server type approach so that instead of running several instances of the same program I just spawn new child processes. In theory this should reduce the load on our server :-) As I've never done any of this before could anyone please suggest web-sites or other sources for...
9
8664
by: Michael Lindsey | last post by:
I need to write a server app to send images to client GUIs that are outside of the server's domain. The client will have the file system path to the image but can not access the file system. I am trying to decide if I should use remoting vs. writing a server that uses networkstreams. I have read that networkstreams\tcp programming should...
7
2372
by: Colin | last post by:
I'm writing a little console socket server but I'm having some difficulty. Can I ask your advice - where is the best place to get some help on that topic? It would be nice if some people who knew what they were doing could take a look at my code and tell me where and why I'm going wrong. Any suggestions of groups or forums?
3
1424
by: Thomas Nielsen | last post by:
Hi, I need to make a web page that wait for 3 asynchronous processes to finish. So I am considering these options 1) Poll the status of the processes from the web page using the "REFRESH" metatag in HTML. 2) Synchronously call a monitor function on the server that poll the status of the processes, and returns when they are done.
4
3804
by: taskswap | last post by:
I have a legacy application written in C that I'm trying to convert to C#. It processes a very large amount of data from many clients (actually, upstream servers - this is a mux) simultaneously. I've read through what must be dozens of ways to do socket communication in C#, and it seems they all devolve into three basic options -...
4
2755
by: Macca | last post by:
I am writing an application that uses asynchronous sockets to get data over ethernet from embedded devices, up to 30 concurrent devices.(These devices are written in C). My application implements an asychronous socket server while the embedded devices are the clients When the data comes in over the socket it is eventually passed into a...
7
9695
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason for this being to stop the user thinking the application has frozen when in fact it is just waiting for a long SP to complete. Another reason for...
0
1748
by: Bishoy George | last post by:
Hi, I have a asp.net 2.0 web application. I want to implement the asynchronous model through http handler in web.config ------------------------------------------------------------------------------------------------------------------------- My web.config file: ---------------------
4
3594
by: Engineerik | last post by:
I am trying to create a socket server which will listen for connections from multiple clients and call subroutines in a Fortran DLL and pass the results back to the client. The asynchronous socket client and asynchronous socket server example code provided in the .NET framework developers guide is a great start but I have not dealt with...
7
6310
by: jtbjurstrom | last post by:
Bear with me because we are new to WCF and have been going through documentation and samples trying to absorb as much as possible in a short amount of time. Any suggestions would be much appreciated. We would of course rather start off on the right path instead of learning later that there's a much better and easier solution, but get stuck...
0
7908
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7950
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8212
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5389
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1447
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.