473,387 Members | 1,882 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,387 software developers and data experts.

Folder Not exist problem in windows service.

hi all

i have one problem in windows service.

i have code as following:-

DirectoryInfo di = new DirectoryInfo(szfolder);
if(di.Exists==true)
eventLog1.WriteEntry("exist");
else
eventLog1.WriteEntry("not exist");

when i give szfolder as path of folder which on lan something like
"\\aa\bb",
where aa is some other computer on lan which is accessiable through my
pc.

above code add entry in log as 'not exist'.

but if i try same code with windows application ' it will display
message as 'exist'./

can some one tell me why this is happening.

any help will be appreciated.

thanks in advance.

Nov 18 '05 #1
3 2016

<tr**************@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
hi all

i have one problem in windows service.

i have code as following:-

DirectoryInfo di = new DirectoryInfo(szfolder);
if(di.Exists==true)
eventLog1.WriteEntry("exist");
else
eventLog1.WriteEntry("not exist");

when i give szfolder as path of folder which on lan something like
"\\aa\bb",
where aa is some other computer on lan which is accessiable through my
pc.


Network shares are not "accessible" from a pc, they are "accesible" from
user logon sessions, and unless your service runs as a user that has access
to the remote share, it won't be able to access the share, even if the
interactive user logon has access.
So make sure that you run your service as a user with access privileges to
the remote share. Note that service accounts like SYSTEM, NETWORK_SERVICE
and LOCAL SERVICE are local accounts, so don't have network access
privileges, though they can be used to access remote shares when running in
a Kerberos real (W2K AD).

Willy.

Nov 18 '05 #2
Hi

thanks for your reply.

Does i have to set accout type as user.

Can u tell me how to run service as a user with access privileges to
remote share.

Because currently my service type is local system

Thanks

Nov 18 '05 #3

<tr**************@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi

thanks for your reply.

Does i have to set accout type as user.

Can u tell me how to run service as a user with access privileges to
remote share.

Because currently my service type is local system

Thanks


Run your service as a domain user, if you aren't running in a domain, you'll
need to create a shadow account (both servers have the same user name with
the same password). To test this you can change your service account through
the services applet.

Willy.

Nov 18 '05 #4

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

Similar topics

4
by: Felipe Garcia | last post by:
I've built a windows service, but this service has it's environment (assemblies, config files) in a folder like c:\myservice\includes. But everytime that i need to load a file, the service always...
12
by: RKay | last post by:
I have a Win2k server running SQL Server 2000. On that box I built a working web service that pulls data from the database. One of the services available simply accepts an ado.net connection string...
5
by: Khalique | last post by:
Hi everyone, I Hope that someone will be able to give me a hint to the solution to my problem. I have developed a web service (vb.net) that needs to access the folders / files and copy files to...
1
by: Benny Ng | last post by:
Dear All, Now I just finished my winform application. And a part of that is to send email reminder to the users. It's working fine in the server that with SMTP service in Windows 2003. But now...
2
by: tatemononai | last post by:
Ok, this is a very unique bug. I have only been able to find one other post related to this online, and everybody who responded misunderstood the problem. I am not trying to reference anything in...
0
by: letibal | last post by:
Hello, I have written a windows service that runs under the LocalSystem account (launched when the computer boots up). This service launches a GUI that contains several...
2
by: Brian | last post by:
Is there a way to set the "start in" folder for a windows service? I am running under the Local System account, and the start in folder seems to be "c:\windows\system32". I use some relative...
3
by: Benry | last post by:
Without having a reference to a specific folder, is there a way that Windows fires an event when files in a folder are modified? I'm using C++.NET 2.0 for programming a service, and would like...
1
by: D2 | last post by:
Hi, We are using FileSystemWatcher class in a windows service to monitor a directory "d:\abc". This path is configured in a config file. When the service is running and FSW is watching this...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...

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.