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

Error opening text file 0x80070002 (Works on XP)

I have written a service designed to run on 2003 Servers, in development it works 100% on my Windows XP system. Once deployed to 2003 I keep getting the same error (File Not Found, error 53) EXCEPTION ERROR: 0x80070002

The file is present, I am using FileExists method, if the file is not present no error, if the file is present FileExists = true and the program tries to open the given file. The error results. I have installed the Lastest .Net Framework 2.0 Redistributable (downloaded from MS 17-05-2007) I was using CreateObject("Scripting.FileSystemObject), OpenTextFile("c:\log\bs.log", 1, True)
I have now changed to using StreamReader: Using sr As New StreamReader("c:\log\bs.log") The result is the same, works on XP, fails on 2003.
I can create files and append to files on 2003, but I can't open for read.

Presently downloading SP1 for VS2005 as a last port of call.

I picked up on an old thread back in Nov 2005 with a similar issue works on XP fails on 2003. The thread ended without any resolution.

Dev machine: Windows XP SP2
Server: Windows 2003 Ent. SP1 running .Net Framework 2.0 (v2.0.50727.42)
Coding in VS2005 Visual Basic
May 18 '07 #1
6 2837
Killer42
8,435 Expert 8TB
Could this be a simple access error? Perhaps you have write-only access to the file.

(Sorry, my terminology is probably all wrong. Nevertheless...)

If you can check that the file exists then presumably you have "directory scan" access. But not necessarily "read".
May 18 '07 #2
Could this be a simple access error? Perhaps you have write-only access to the file.

(Sorry, my terminology is probably all wrong. Nevertheless...)

If you can check that the file exists then presumably you have "directory scan" access. But not necessarily "read".
Thanks for the response,

I have checked this, initially the Service was running using an account that only had access to the SQL database into which the data is piped. I changed it to a Local Admin account, went a step further and gave all users Full access to the folder and files. The application creates a log file and an error log file, these files are created in the same folder with no issue. Just can't read (can create/append/write).
May 18 '07 #3
Killer42
8,435 Expert 8TB
Weird stuff. This sounds like it might be one for the Windows forum, more so than VB. Can you try to read the file some other way (that is, other than through VB), just to narrow down where the problems is?
May 18 '07 #4
Just used a VBScript to test it, code as follows, the same as my orginal code in the VB App.
Sub OpenLog
Dim fso, f,strLine,count
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\log\bs.log", 1, True)
do while not f.atendofline
strLine = f.readline
loop
msgbox strline
f.Close
End Sub

Works fine, returning the last line of the file in a Msgbox. Run on the server logged in with the same account as that with which the service starts. I also have a Viewer that read the log file, when it is run with the same user, it fails with the same error, unable to read the contents of the file the Service creates. Logging.log

VS2005 SP1 installed, soon will see if that resolves my woes!
May 18 '07 #5
Well to close this up
I have resolved the problem, alas not to sure what the cause/resolution was.
Installed VS2005 SP1. Created a new Test app to open the evil file. Worked fine. Recreated the module in a new module for my existing service. Bob's your Aunty it works. Can only assume that the Service Pack did the trick. Even rebuiling under the new SP didn't work, seems like I had to make a new module to get it to build properly.
May 18 '07 #6
Killer42
8,435 Expert 8TB
Well to close this up
I have resolved the problem, alas not to sure what the cause/resolution was.
Installed VS2005 SP1. Created a new Test app to open the evil file. Worked fine. Recreated the module in a new module for my existing service. Bob's your Aunty it works. Can only assume that the Service Pack did the trick. Even rebuiling under the new SP didn't work, seems like I had to make a new module to get it to build properly.
That is weird. Oh well, I suppose the important thing is that you've got it working. It would be nice to know what happened, though.
May 19 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: srikanth | last post by:
Failed to execute request because the App-Domain could not be created. Error: 0x80070002 The system cannot find the file specified. I am getting this error (in the event log) when trying to...
0
by: Erik Anderson | last post by:
There is a COM object (written in ATL) that I have been using for a little while (in scheduled events mostly) that I am very interested in getting to run inside of an ASP page. This site uses...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
2
by: Keith Kowalski | last post by:
I anm opening up a text file reading the lines of the file that refer to a tif image in that file, If the tif image does not exist I need it to send an email stating that the file doesn't exist...
29
by: aarthi28 | last post by:
Hi, I have written this code, and at the end, I am trying to write a vector of strings into a text file. However, my program is nor compiling, and it gives me the following error when I try to...
1
by: Carlos Sosa Albert | last post by:
Hello people, I'm having an issue registering an assembly in ONE server. I've already tried to reinstall the .NET framework 2.0 but the error is still there. I enabled the logging but nothing...
0
by: silviu | last post by:
Hello I'm trying to install Microsoft SQL 2005 Server Express Edition but I'm getting the following error: SQL Server Setup unexpectedly failed... Then it says something about a log file. Here's...
0
by: saintor1 | last post by:
Access 97 This error looks to me as secondary. In fact, it bugs when the opening report tries to close a form. If I try to open the report directly, I have a different message, stating that...
0
by: jewrenaj | last post by:
Help Currently installed Business Objects XI Live Office this is a addin for Office application: Whenever user goes to refresh Query in Live Office from Excel user receives An error occurred when...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.