0

I have uploaded a site on azure using shared service plan.Whenever i try to download any excel file i get below error.

The process cannot access the file 'D:\home\site\wwwroot' because it is being used by another process.

I have used below download code to get fileLocation: HostingEnvironment.MapPath(@"~/Files/" + FileName)

It is working fine on my local environment. Issue only arises if i do the download from the hosted site.

GPS
  • 29
  • 3
  • 1
    What happens if you try `Path.Combine(Assembly.GetEntryAssembly().Location, "Files")` instead? That's how I access a directory in a web app hosted in Azure App Service. – Dan Wilson Sep 18 '18 at 17:26
  • I have around 5 sites hosted on azure and for other websites download is working fine . Only that site is throwing this error "The process cannot access the file 'D:\home\site\wwwroot' because it is being used by another process." and i dont know how to troubleshoot this issue – GPS Sep 18 '18 at 17:45
  • I even see that file on azure server using this link " scm.azurewebsites.net". its only downloading throwing an error – GPS Sep 18 '18 at 17:47
  • probably [this issue](https://stackoverflow.com/a/11319623/578411). That shared server is not running on IIS. Try what @DanWilson suggested. – rene Sep 18 '18 at 18:45
  • As i said i can see the file on that path and even HostingEnvironment.MapPath returning me a correct location. But the problem is I am not able to download a file as it is throwing an error The process cannot access the file 'D:\home\site\wwwroot' because it is being used by another process. And i am not able to download only one particular excel file and rest of the files are downloaded correctly – GPS Sep 18 '18 at 18:56
  • What is your question? – Ton Plooij Sep 18 '18 at 20:42

0 Answers0