472,378 Members | 1,251 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,378 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 21187
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: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

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.