By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 1,033 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

Accessing Mapped Network Drive from Service

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.