473,327 Members | 2,016 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,327 software developers and data experts.

Accessing Mapped Network Drive from Service

Hi All,

I am trying to access a mapped network drive from a service that I have
created.

The service needs to create/delete folders/files on a network drive. When I
tried to connect to a folder on mapped network drive (eg. N:\Storage that
corresponds to \\FS1NS\SharedDir\), I get an error as "Could not find part
of path N:\".

I tried running the service in the Administrators account but the same
problem. The thing works if I directly access the network share
\\FS1NS\SharedDir\.

Can anybody please throw some light on whats happening here? Is there
anykind of restriction on access to the mapped drives when tried from a
service (it did work from a C# windows application).

Many thanks in advance

Regds,
Niloday
Nov 15 '05 #1
5 21506
Probably the account that you are using does not has the N: drive mapped to
\\FS1NS\SharedDir\. I suggest you try in your code to use the UNC
(\\FS1NS\SharedDir\) instead of N:\Storage.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Niloday" <ni******@rheal.com> schreef in bericht
news:uF*************@tk2msftngp13.phx.gbl...
Hi All,

I am trying to access a mapped network drive from a service that I have
created.

The service needs to create/delete folders/files on a network drive. When I tried to connect to a folder on mapped network drive (eg. N:\Storage that
corresponds to \\FS1NS\SharedDir\), I get an error as "Could not find part
of path N:\".

I tried running the service in the Administrators account but the same
problem. The thing works if I directly access the network share
\\FS1NS\SharedDir\.

Can anybody please throw some light on whats happening here? Is there
anykind of restriction on access to the mapped drives when tried from a
service (it did work from a C# windows application).

Many thanks in advance

Regds,
Niloday

Nov 15 '05 #2
Hi,

the mapped drive works fine when i try to access from my windows application
developed in C#, however the same does not work when i try it from windows
service developed in C#.

The main purpose for doing this is becuase the service will be running on 2
different machine & will be accessing different shared folders on different
servers. So in order to avoid hard coding the network share I intend to use
a mapped network drive. Here again we do not have the option of reading the
network share from a file or database.

thanks
Niloday.

"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:eg**************@tk2msftngp13.phx.gbl...
Probably the account that you are using does not has the N: drive mapped to \\FS1NS\SharedDir\. I suggest you try in your code to use the UNC
(\\FS1NS\SharedDir\) instead of N:\Storage.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Niloday" <ni******@rheal.com> schreef in bericht
news:uF*************@tk2msftngp13.phx.gbl...
Hi All,

I am trying to access a mapped network drive from a service that I have
created.

The service needs to create/delete folders/files on a network drive. When
I
tried to connect to a folder on mapped network drive (eg. N:\Storage

that corresponds to \\FS1NS\SharedDir\), I get an error as "Could not find part of path N:\".

I tried running the service in the Administrators account but the same
problem. The thing works if I directly access the network share
\\FS1NS\SharedDir\.

Can anybody please throw some light on whats happening here? Is there
anykind of restriction on access to the mapped drives when tried from a
service (it did work from a C# windows application).

Many thanks in advance

Regds,
Niloday


Nov 15 '05 #3
Niloday

You could store the string value for the share in a config file for example,
so you don't need to hardcode it.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Niloday" <ni******@rheal.com> schreef in bericht
news:ez*************@TK2MSFTNGP12.phx.gbl...
Hi,

the mapped drive works fine when i try to access from my windows application developed in C#, however the same does not work when i try it from windows
service developed in C#.

The main purpose for doing this is becuase the service will be running on 2 different machine & will be accessing different shared folders on different servers. So in order to avoid hard coding the network share I intend to use a mapped network drive. Here again we do not have the option of reading the network share from a file or database.

thanks
Niloday.

"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:eg**************@tk2msftngp13.phx.gbl...
Probably the account that you are using does not has the N: drive mapped

to
\\FS1NS\SharedDir\. I suggest you try in your code to use the UNC
(\\FS1NS\SharedDir\) instead of N:\Storage.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Niloday" <ni******@rheal.com> schreef in bericht
news:uF*************@tk2msftngp13.phx.gbl...
Hi All,

I am trying to access a mapped network drive from a service that I have created.

The service needs to create/delete folders/files on a network drive. When
I
tried to connect to a folder on mapped network drive (eg. N:\Storage

that corresponds to \\FS1NS\SharedDir\), I get an error as "Could not find part of path N:\".

I tried running the service in the Administrators account but the same
problem. The thing works if I directly access the network share
\\FS1NS\SharedDir\.

Can anybody please throw some light on whats happening here? Is there
anykind of restriction on access to the mapped drives when tried from a service (it did work from a C# windows application).

Many thanks in advance

Regds,
Niloday



Nov 15 '05 #4
The drive mapping belongs to the interactive logon session, the service runs
in a private logon session (even if they both are running as administrator)
and as such has no corresponding network share for drive N. The only options
you have are (preferably) to use UNC names or map the drive in your service
code.

Willy.
"Niloday" <ni******@rheal.com> wrote in message
news:ez*************@TK2MSFTNGP12.phx.gbl...
Hi,

the mapped drive works fine when i try to access from my windows application developed in C#, however the same does not work when i try it from windows
service developed in C#.

The main purpose for doing this is becuase the service will be running on 2 different machine & will be accessing different shared folders on different servers. So in order to avoid hard coding the network share I intend to use a mapped network drive. Here again we do not have the option of reading the network share from a file or database.

thanks
Niloday.

"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:eg**************@tk2msftngp13.phx.gbl...
Probably the account that you are using does not has the N: drive mapped

to
\\FS1NS\SharedDir\. I suggest you try in your code to use the UNC
(\\FS1NS\SharedDir\) instead of N:\Storage.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Niloday" <ni******@rheal.com> schreef in bericht
news:uF*************@tk2msftngp13.phx.gbl...
Hi All,

I am trying to access a mapped network drive from a service that I have created.

The service needs to create/delete folders/files on a network drive. When
I
tried to connect to a folder on mapped network drive (eg. N:\Storage

that corresponds to \\FS1NS\SharedDir\), I get an error as "Could not find part of path N:\".

I tried running the service in the Administrators account but the same
problem. The thing works if I directly access the network share
\\FS1NS\SharedDir\.

Can anybody please throw some light on whats happening here? Is there
anykind of restriction on access to the mapped drives when tried from a service (it did work from a C# windows application).

Many thanks in advance

Regds,
Niloday



Nov 15 '05 #5
Hi,

Many thanks for all your replies.

After beating around a lot, I have realised that, I cannot access the
mapped network drive from the windows service. -what a strange thing :(

Finally I have used a config file to store the UNC (with no other
options left).

Thanks anyway to all of you. Looking forward for your support in
future.

Regds,

Niloday

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #6

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

Similar topics

2
by: AMD | last post by:
Hi, I would like to have MySQL use a mapped network drive. I'd like to do this in case there is a failure of the mysql machine, I can just replace it with a new machine pointing to the same...
1
by: Z0gS | last post by:
I got this problem for the web application I try to access files on a remote server. string dirs = Directory.GetDirectories(@"E:\vehicles") E drive is a map to a network drive. I get the...
1
by: Max Baki via .NET 247 | last post by:
I all, i've write a sample ftp Windows service which download files and copy them on remote share or remote mapped drive (the service works fine on local drives). This part of code is the...
3
by: Bonj | last post by:
I have a service which is a Windows Service, but it is running under a User account - I enter my own credentials on installing. It can access network files by specifying the full UNC path, i.e....
5
by: Nirosh | last post by:
Hi All, Can any one suggest me a best way to do this .. I have a thrid party tool "EXE" that we need to use with our web service to manipulate some complex XML files, which reside in a...
2
by: Dave Stewart | last post by:
I am attempting to write a vb.net windows service that will automate various file movements on my network. When I attempt to access files on a mapped drive or UNC file share, I get exceptions...
8
by: Ben Fidge | last post by:
Hi I have a small WinForms app that needs to copy files from a shared drive on a network. If I connect to the mapped drive using Explorer, a password dialog pops-up and I have to provide...
4
by: sajid_yusuf | last post by:
Hi I am trying to develop a Windows service in VB.NET which has timer enabled and keeps checking a folder (or group of folders) for any new file or changed files. As soon as it detects any new...
5
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I am trying to accesss a Mapped Drive from my asp.net code running on IIS 6.0. I am using a FileUpload control and fileUpload.SaveAs() to save the file to the server. I want to save the file to...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.