Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find a part of the path on windows azure

I deployed mvc-3 application on windows azure. In my application i am uploading the file an save it in the App_Data/DownloadedTemplates folder.

  var path = Server.MapPath("~App_Data/DownloadedTemplates");

my application is running on staging environment currently. When i uploaded file , it shows me an exception in the browser :

Could not find a part of the path 'F:\sitesroot\0\App_Data\DownloadedTemplates\B.htm_2c77cdfd-c597-4234-bd1e-29ca0a9b8d0e.htm'.

I am using Server.MapPath to locate the path of App_Data on the server, now why this exception ?. Can anybody tell me the problem ?

like image 659
King Kong Avatar asked Jul 27 '12 12:07

King Kong


People also ask

Could not find a part of the path TFS?

The error you have is mainly caused when you're trying to check in files which is no longer exist on the machine. To resolve it, go to Source Control Explorer -> select these missing files -> Undo Pending Changes. Or you can just left these files in the Excluded Changes list to not checking them.

What is Website_run_from_package?

Using WEBSITE_RUN_FROM_PACKAGE = URL. This section provides information about how to run your function app from a package deployed to a URL endpoint. This option is the only one supported for running from a package on Linux hosted in a Consumption plan.

How do I access Azure App Service files?

You can access it from within the App Service Editor under your app name -> Open Kudu Console or through the portal under Advanced Tools.


1 Answers

You shouldn't be doing this in a Windows Azure application. In Windows Azure you should use LocalResources (reserved space on a dedicated disk) for saving temp files on the disk, this is the only place where you should store data.

Here is an example of how you would access such a LocalResource (name and size can be configured in the VS project):

LocalResource localResource = RoleEnvironment.GetLocalResource("DownloadedTemplates");

Don't forget that data in LocalResources might disappear (when the machine crashes for example). If you really want to persist your data, you should be using Windows Azure Blob Storage.

like image 169
Sandrino Di Mattia Avatar answered Oct 12 '22 02:10

Sandrino Di Mattia