473,396 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Path references in a .NET Windows Service Application

I created a Windows Service and part of its functionality
is to move a PDF file from a location on the service's
local drive stInPath (C:\PDF\) to a location on another
server stOutPath (\\123.123.123.123\C\PDF\) with this line
of code:

fs.MoveFile(stInPath, stOutPath)

For testing I've been using the same code in a windows
Application form. When I run the Application Form the
file move is successfull. When I run the code in my
service however, it doesn't do the move. If I have my
service move locally it works. I've tried mapping the IP
address to a drive letter and referencing that but it
doesn't move that way either. Is there some trick I'm
missing about path references in Windows Services?
Nov 20 '05 #1
1 2704
Zachariah,

Your problem is with the Network credentials of the Service. When you run
the application form, the application uses the credentials of the logged on
user (you) and therefore can connect to the remote resource.

when you run the code as a service, the service runs under the security
context of the local system account. The local system account cannot copy
files to a remote location since the destination machine has no knowledge of
the local system account. This would explain why you can move locally when
running as a service but not remotely. To get around this, open the services
manager and specify a logon account for the service. This should resolve
your issue. Let me know how it works out.

Eric

"Zachariah" <za*********@yahoo.com> wrote in message
news:00****************************@phx.gbl...
I created a Windows Service and part of its functionality
is to move a PDF file from a location on the service's
local drive stInPath (C:\PDF\) to a location on another
server stOutPath (\\123.123.123.123\C\PDF\) with this line
of code:

fs.MoveFile(stInPath, stOutPath)

For testing I've been using the same code in a windows
Application form. When I run the Application Form the
file move is successfull. When I run the code in my
service however, it doesn't do the move. If I have my
service move locally it works. I've tried mapping the IP
address to a drive letter and referencing that but it
doesn't move that way either. Is there some trick I'm
missing about path references in Windows Services?

Nov 20 '05 #2

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

Similar topics

1
by: bob | last post by:
I have created a simple Windows service in VB.Net which installs fine using InstallUtil.exe to install it to, for example "c:\test", or "c:\Windows\YellowBanana", but if I install it to "c:\Program...
11
by: Wolfgang Kaml | last post by:
I am not sure if this is more of an expert question, but I am sure that they are out there. I'd like to setup a general application or bin directory on my Win2003.Net Server that will hold some...
13
by: Adam | last post by:
Trying to get an asp.net 2.0 app running and am receiving this error. I see a bunch of people with this error on the net, but no solution: Works fine on my local machine, deployed to a server it...
4
by: Jim | last post by:
I am writing a Windows Service in VB.Net, and right upfront I need to pass the path to my config.xml file to the constructor of the class which reads it. In the old days, App.Path & "\config.xml"...
3
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images ...
3
by: Juhan | last post by:
Hi! I have a strange error in a console application that is hosted by IIS 5.0 and invokes a web service hosted on the same machine. A request form the web comes in and it is dispatched to a...
0
by: emu | last post by:
Hi All, I have an unmanaged C++ application that references a mixed mode image DLL (mixed managed and unmanaged). Under .NET 1.1 we could trust the dll (the mixed mode dll) by running the...
3
by: =?Utf-8?B?Q3JhaWc=?= | last post by:
Background: I am building a Windows enterprise application that has separate assemblies for UI, business logic/rules, and data access (i.e. typical N-tier architecture). Many of the assemblies...
12
by: Anil Gupte | last post by:
I wrote my Windows Service first as a regular Windows Exe because it is easier to debug. In that I used AppDir = Application.ExecutablePath.Substring(0,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
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...
0
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...
0
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,...
0
jinu1996
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...
0
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...
0
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...

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.