I am writing a small Windows Service in C#. It is structured as two C#
programs, one, let's call it myAction, that runs as a command line
program and a second, let's call it myWrapper, that is the actual
windows service, which starts the first program as a child process (and
then waits for the child process to terminate, restarting it should
that ever happen).
When run on its own from a shell window, myAction opens and reads its
input files without any problem.
When run from within myWrapper, myAction appears not to have sufficient
permission to access its input files.
A little additional research has shown that if the input files reside
on the local disk, myAction always works properly, standalone or from
myWrapper. If the files reside on a network drive, only the myWrapper
invocation fails.
The service is instaled with the Visual Studio .NET 2003 generated
setup complete with the necessary ProjectInstaller, containing a
ServiceInstaller and ServiceProcessInstaller. I am specifying my
network login for the service during its installation, and
Environment.UserName seems to indicate the service is indeed running
under my network account.
This application really needs to be able to operate on files residing
both locally and on network drives, so I need to fully understand what
is going on here. I remember there is some magic incantation that needs
recitation for this, but I can't remember the words.
Thanks for your help... 4 6827
Are you accessing the files on the network servers using a UNC path?
Willy.
<ma*********@ACM.ORG> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com... I am writing a small Windows Service in C#. It is structured as two C# programs, one, let's call it myAction, that runs as a command line program and a second, let's call it myWrapper, that is the actual windows service, which starts the first program as a child process (and then waits for the child process to terminate, restarting it should that ever happen).
When run on its own from a shell window, myAction opens and reads its input files without any problem.
When run from within myWrapper, myAction appears not to have sufficient permission to access its input files.
A little additional research has shown that if the input files reside on the local disk, myAction always works properly, standalone or from myWrapper. If the files reside on a network drive, only the myWrapper invocation fails.
The service is instaled with the Visual Studio .NET 2003 generated setup complete with the necessary ProjectInstaller, containing a ServiceInstaller and ServiceProcessInstaller. I am specifying my network login for the service during its installation, and Environment.UserName seems to indicate the service is indeed running under my network account.
This application really needs to be able to operate on files residing both locally and on network drives, so I need to fully understand what is going on here. I remember there is some magic incantation that needs recitation for this, but I can't remember the words. Thanks for your help...
Hi Willy,
The network test path is "j:\testdir\filename". My local test path is
"c:\testdir\filename" and that one works with no problem.
-Marc
That's your problem, J: is a mapped drive, but the session to wich it is
mapped is not the "service logon session" but the "interactive logon
session" and in Sessions cannot be shared in Windows even if both refer to
the same user account.
So you have to create a new session from within your service, or
(preferably) you have to use a UNC path.
Willy.
<ma*********@ACM.ORG> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com... Hi Willy,
The network test path is "j:\testdir\filename". My local test path is "c:\testdir\filename" and that one works with no problem.
-Marc
Okay, I understand the problem... now I need help with the fix. I am
installing my service from a setup generated from Visual Studio .NET
2003. I have the user entering the filepath for the input file for my
service. I am not sure how I take that user input (from an optional
text box dialog) and convert it into the UNC path (which I should be
able to do since the install is running in the user's session... it
also gives me the chance to validate that the supplied filepath
resolves to an actual file) which I then store in a registry key value.
Right now the install is just unconditionally creating the key value
with the content the user supplies, and no validation. I can't find any
documentation on how I do this, though I presume I need a custom
action?
Thanks very much for your help,
Marc This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Wolfgang Kaml |
last post by:
Hello All,
I have been working on this for almost a week now and I haven't anything up
my sleeves anymore that I could test in addition or change....
Since I am not sure, if this is a Windows...
|
by: Ken Lindner |
last post by:
I have a need to become familiar with SQL Server 2000 for work.
Needless to say I am new to SQL Server any version, but not IT in
general. My employer has provided me with the SQL Server 2000...
|
by: SP |
last post by:
Hi All,
I wrote a windows service which is supposed to stop after specified amount
of time. I am calling OnStop() after specified time. OnStop() methods
executed but I dont see the service...
|
by: Primo |
last post by:
Hi,
This problem has been frustrating me for days and I hope you experts can
help me out. I am trying to run a command, which I would normally run from
the command line, from within my C#...
|
by: Bijesh |
last post by:
Hi All,
I've developed a Windows Service that acts as a remoting server (.NET
Remoting). The client(user) is able to connect to the server and start a
program by giving the executable path of...
|
by: Joseph Geretz |
last post by:
I'm having a credentialing problem in my web application. Actually, I don't
think this is an IIS security issue, since I'm able to access the page I'm
requesting. However, the executing page itself...
|
by: Amjad |
last post by:
Hi,
I just wrote a test Windows Service that creates a text file on startup
(please see my code below). The file is never created.
Protected Overrides Sub OnStart(ByVal args() As String)
Dim...
|
by: Charles Leonard |
last post by:
I am having yet another issue with Windows Server 2003. This time, the web
service (a file import web service) appears to run except for one odd
message: "ActiveX component can't create object". ...
|
by: dermot |
last post by:
I have wrriten a small windows service application in visual studio
..net 2003 which listens for incoming FTP files.
These files would overwrite over time due to duplicate file names.
However any...
|
by: =?Utf-8?B?cnZhbmdlbGRyb3A=?= |
last post by:
Hello,
I have a problem with our OnlineBackupService.exe. This is a Windows Service
which is built in .Net 1.1 and basically grabs files from the file system and
will try to upload them using...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
| |