Azure : The process cannot access the file "" because it is being used by another process.
Posted
by Shantanu
on Stack Overflow
See other posts from Stack Overflow
or by Shantanu
Published on 2010-05-29T21:09:44Z
Indexed on
2010/05/29
21:12 UTC
Read the original article
Hit count: 372
Hi all,
I am trying to get a matlab-compiled exe running on Azure cloud, and for that purpose need to get a v78.zip onto the local storage of the cloud and unzip it, before I can try to run an exe on the cloud. The program works fine when executed locally, but on deployment gives and error at line marked below in the code. The error is :
The process cannot access the file 'C:\Resources\directory\cc0a20f5c1314f299ade4973ff1f4cad.WebRole.LocalStorage1\v78.zip' because it is being used by another process.
Exception Details: System.IO.IOException: The process cannot access the file 'C:\Resources\directory\cc0a20f5c1314f299ade4973ff1f4cad.WebRole.LocalStorage1\v78.zip' because it is being used by another process.
The code is given below:
string localPath = RoleEnvironment.GetLocalResource("LocalStorage1").RootPath;
Response.Write(localPath + " \n");
Directory.SetCurrentDirectory(localPath);
CloudBlob mblob = GetProgramContainer().GetBlobReference("v78.zip");
CloudBlockBlob mbblob = mblob.ToBlockBlob;
CloudBlob zipblob = GetProgramContainer().GetBlobReference("7z.exe");
string zipPath = Path.Combine(localPath, "7z.exe");
string matlabPath = Path.Combine(localPath, "v78.zip");
IEnumerable<ListBlockItem> blocklist = mbblob.DownloadBlockList();
BlobStream stream = mbblob.OpenRead();
FileStream fs = File.Create(matlabPath); (Exception occurs here)
It'll be great help if someone could tell me where I'm going wrong.
Thanks! Shan
© Stack Overflow or respective owner