Solved

System.IO.IOException: The device is not ready

Posted on 2010-11-08
12
3,864 Views
Last Modified: 2012-05-10
I have an ASP .NET application that is copying two files to a new location.
All users work perfect except for only two that are getting the following error:

Exception of type 'System.Web.HttpUnhandledException' was thrown.: System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.IO.IOException: The device is not ready. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite) at System.IO.FileInfo.CopyTo(String destFileName, Boolean overwrite)

See code below.

Thanks,
Dim aPath As New IO.FileInfo(strArtPath)

        Dim aWork As New IO.FileInfo(strArtWork)

        aPath.CopyTo("\\prodart\markport\" & newarchiveID & aPath.Extension, True)

        aWork.CopyTo("\\prodart\markport\" & newarchiveID & aWork.Extension, True)

Open in new window

0
Comment
Question by:melinalt
  • 5
  • 5
12 Comments
 
LVL 9

Expert Comment

by:puru1981
Comment Utility
Check if the user has permission for write at the location.
0
 
LVL 1

Author Comment

by:melinalt
Comment Utility
Thanks puru1981:
All my users have full access/rights to the server.
I am also using identity impersonate in my webconfig (using the administrator credentials)
<identity impersonate="true" userName="server\administrator" password="administratorpassword"/>
0
 
LVL 9

Expert Comment

by:puru1981
Comment Utility
One thing more are you closing the aPath and aWork files. this error occurs when the file is in use.
0
 
LVL 1

Author Comment

by:melinalt
Comment Utility
ok.. so that is probably what's happening but I can't find an atribute/member to close the file.

These don't work with IO.Systemfile

aWork.close()
aWork.dispose()

Or should I do something like this?

 Using workfs As IO.FileStream = aWork.Open(IO.FileMode.Open, IO.FileAccess.Write, IO.FileShare.ReadWrite)
            aWork.CopyTo("\\prodart\markport\" & newarchiveID & aWorkExtension, True)
 End Using

But not sure if it will work...

Thanks a lot for helping me out.

0
 
LVL 9

Expert Comment

by:puru1981
Comment Utility
using is used only with classes which use IDisposable interface.

i think there is some other issue is preventing to copy the file. can you do one thing add same random string at the end of the file and then check if it still happens.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:melinalt
Comment Utility
I am afraid I can't since these are all art files (jpg, ia, png, etc)  :(
0
 
LVL 9

Expert Comment

by:puru1981
Comment Utility
it is happening randomly or every time??
0
 
LVL 1

Author Comment

by:melinalt
Comment Utility
For one user is randomly for the other one is all the time.
0
 
LVL 9

Accepted Solution

by:
puru1981 earned 500 total points
Comment Utility
I think this is due to this

newarchiveID

once this is generated it is not allowing other threads to create the same.

so you need to be aware if the same archive id is used by all the users if first user is writing the file no other user can access it so you are getting the error.
0
 
LVL 1

Author Comment

by:melinalt
Comment Utility
Good thinking but I don't think that is the problem. Let me explain the newarchiveID  a little bit more.

An user works in two versions of the same file
aPath is the path to the art file which is always a JPG
aWork is the path to the work file wich is an editable version of the JPG (illustrator, photoshop, etc).

When they finish working on the files they are requiered to copy both files to our art server.

When they do this, the system creates a unique id for each file  (newarchiveID) and copies both files to the art server, both with the same name (newarchiveID ) but they keep their extensions so we know what type of files are they.

So, the newarchiveID  is a unique consecutive number generated by the system to idenfity the set of files but it is totally different between users, so, there are not going to be two users using the same newarchiveID .

I do think that you are correct and the issue has to do with the fact that the file is not being closed, after copied.


0
 
LVL 29

Expert Comment

by:Kumaraswamy R
Comment Utility
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now