473,657 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why can't I access a file in Network driver from Windows Service?

I write a program accessing files in network drive o:. It is doable as a
standalone application. However, if it is running under windows service,
the following exception will appear:

13/07/2004 10:24:48 AM run() error: System.IO.IOExc eption: The specified
network password is not correct.

at System.IO.__Err or.WinIOError(I nt32 errorCode, String str)
at System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, Boolean useAsync, String
msgPath, Boolean bFromProxy)
at System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess
access, FileShare share)
at dump_tool.Dump_ Load.run()
The source codes relevant are:

Cur_Fs = File.Open( Cur_File, FileMode.Open, FileAccess.Read ,
FileShare.Read );

Where Cur_File = "o:\jul04\10\fa res.fl", o: is a mapped network drive.



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
1 2393
Normally, when you run as a service, you are running as the 'local system'
account, which has no access rights for network resources. Create or use a
known domain account, and in the service settings, set the identity of the
service to this account.

--- Nick

"Daniel Xiao" <xi*******@yaho o.com> wrote in message
news:uc******** ******@TK2MSFTN GP09.phx.gbl...
I write a program accessing files in network drive o:. It is doable as a
standalone application. However, if it is running under windows service,
the following exception will appear:

13/07/2004 10:24:48 AM run() error: System.IO.IOExc eption: The specified
network password is not correct.

at System.IO.__Err or.WinIOError(I nt32 errorCode, String str)
at System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, Boolean useAsync, String
msgPath, Boolean bFromProxy)
at System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess
access, FileShare share)
at dump_tool.Dump_ Load.run()
The source codes relevant are:

Cur_Fs = File.Open( Cur_File, FileMode.Open, FileAccess.Read ,
FileShare.Read );

Where Cur_File = "o:\jul04\10\fa res.fl", o: is a mapped network drive.



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #2

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

Similar topics

6
9703
by: moonriver | last post by:
I write a program accessing files in network drive o:. It is doable as a standalone application. However, if it is running under windows service, the following exception will appear: 13/07/2004 10:24:48 AM run() error: System.IO.IOException: The specified network password is not correct. at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare...
2
3223
by: Jim Richards | last post by:
I have been told by a local PC club technician that 98SE cannot read NTFS drives in a network. Is this true? TIA, Jim.
7
8660
by: Mullin Yu | last post by:
if i put the same code at the windows application or console, i can logon to the computer. but, if i put the same code at the windows service and start it, i still can't logon to the machine. the return value is TRUE. i tested it by going to windows explorer and then click that computer. my coding at windows service:
3
7637
by: Daniel Xiao | last post by:
I write a program accessing files in network drive o:. It is doable as a standalone application. However, if it is running under windows service, the following exception will appear: 13/07/2004 10:24:48 AM run() error: System.IO.IOException: The specified network password is not correct. at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare...
6
2927
by: Rob | last post by:
Hi, I am working on a project that requires a Windows Service which performs the following file transfer functions. 1. It monitors a specific local directory on a Windows 2003 Server. 2. When it finds files with a specific extension, it queries a SQL Server database to determine what workstation will be the destination of a File.Copy. 3. It copies those files to the appropriate workstations on the LAN,
3
2226
by: shapper | last post by:
Hello, In have a class inside a compiled DLL where I have the following code: ' Create site map XML document Dim siteMap As XmlDocument = New XmlDocument ' Load site map XML document from ASP.NET web site map siteMap.Load(HttpContext.Current.Server.MapPath(Me.SiteMapUrl)) Me.SiteMapUrl is a property.
6
5557
by: royan | last post by:
Help please! I have the same problem which this post http://groups.google.com/group/microsoft.public.vsnet.vstools.office/browse_thread/thread/91275741fa1e100f/164638c6d6ba3872?lnk=gst&q=System.UnauthorizedAccessException%3A+Access+is+denied.&rnum=1&hl=en#164638c6d6ba3872 When I deploy our ASP.NET Application web form to Windows server 2003 I got access deny error. We are using the Microsoft.Office.Interop.Word COM DLL. We need to read a...
7
4745
by: Speech Lover | last post by:
I have problem writing content to a UNC file from my ASP.NET 1.1 application. This is on Windows server 2003 The event log says "X:\temp\abc.txt path not found" and stuff. Note that I have allowed Full Control permission on abc.txt on the other machine. any idea? thanks,
5
1965
by: cj2 | last post by:
This code works: using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Linq; using System.Web; using System.Web.Services; using System.Web.Services.Protocols;
0
8385
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8821
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8723
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8502
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8602
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.