The easiest way to access Azure File Storage? - asp.net

I need to migrate an application to Azure and I have a Azure Web Application with 50gb storage space and an Azure File Storage with 250gb, that I'll use to store videos, images and other things.
My application stores the files in a folder in the same directory of my application, so It was easy to do, I didn't have to access another server, like Azure File Storage seems to be.
I have access by FTP to my app folder, like It was at the other server, but this folder only have the 50GB of storage. Does exist an way of mapping the 250gb's Azure File Storage folder to my app folder, or I'll have to change my code to use the Azure API?

Your application can work against Azure File shares without code changes. You will need to persist credentials using cmdkey, and then instead of local path, use the file share path or mounted drive within your application. For more information you can refer to:
How to use Azure Files on Windows
How to use Azure Files on Linux

I run a batch file on login which runs the following command, you can use whichever drive letter you choose:
net use <drive-letter>: /delete /y
net use <drive-letter>: \\<storage-account-name>.file.core.windows.net\<share-name> /u:<storage-account-name> <storage-account-key>
An example with dummy information would look like this:
net use t: /delete /y
net use t: \\testaccount.file.core.windows.net\testshare /u:accountname verylongstorageaccountkey

Related

How to deploy Javafx desktop application with Hsqldb

I've completed a Java project with Hsqldb, the application works fine on my local machine, this is intended to be used as a standalone desktop application on the Windows platform. Please could you suggest any references/documentation on how to go about the deployment processes. Thanks in advance.
For deploying an embedded HSQLDB database, the only thing that can be different on the target is the location of the database files.
You define the directory where files are stored and it should be a writable directory. In this case, define the path and use it as an absolute path (which includes the drive name if any) to connect to HSQLDB.
You can also define the database connection URL to contain the user home directory path. This allows storing the database is a subdirectory of the user's home directory. See http://hsqldb.org/doc/2.0/guide/dbproperties-chapt.html#dpc_variables_url

How do I navigate to my Visual Studio's App_Data folder in relative way

I have an ASP.NET Web Api project which has App_Data folder. Inside of it I have a database file(.sqlite) which I use in my application. There's a connection string to it that resides in my configuration files. The path is absolute and includes my current file structure(C:\Something\Other\App_Data\MyDb.sqlite). The problem is that I want to host it on Azure and most likely Azure won't find this path. So, for that purpose I would like to use a relative path so on Azure the file gets properly located.
Within your server side code (C#, VB.NET, etc.) you can use: ~/App_Data/.
If you are trying to reach the directory within a connection string you can use: Data Source=|DataDirectory|DatabaseName.sdf
If you want to use Azure web app with single instance, please try the connection string that Jesse Johnson provided. If your web app need scale across multiple machines, I think SqlLite is not suitable for you to use. Azure Web App ARR will dispatch the request to some instance, and your data will saved to this instance via SqlLite. If next time the request is dispatched to another instance, I think you could not read the data you saved before. I think it is better to choose Azure Storage or Azure SQL to save your data.

Azure asp.net - why the webjob %temp% folder is not the same as the web app %temp% folder?

I have a webjob that writes some data on the %temp% folder, which maps to d:\local\temp.
When i use the console tool on the azure portal, the data is there, on d:\local\temp.
When i try to access the files on the website (asp.net) the files are not there. But %temp% also maps to d:\local\temp.
Why?
Is there a path that maps to the same location?
The data I write on the local %temp% is a cache of a data stored on azure storage blob. I can re-create the cache if the data on %temp% is lost.
Thanks.
The main web app and the webjob run in 2 different sandboxed environments on the same VM. They have access to the same D:\home, but different D:\local.
Keep in mind that D:\home and D:\local are virtualized paths. They don't really exist on the filesystem. That's why you can run as many sites as you want on the same VM and each will have their own D:\home and D:\local.
If you want them to share something through the filesystem, you'll have to drop it under D:\home

Uploading file Azure Clound Service WebRole gives me an error: Access to path denied

I have an ASP.NET MVC Application running as an Azure Cloud Service WebRole and I need to b able to upload files to my /Views/Whatever directory so I can quickly edit files on the fly without having to re-publish which can take 30 minutes.
How can I set the permissions to allow me to save files to this path?
If it's a single instance Web Role (which I assume it would be, I can't imagine you editing files on each one of the instances), then you can just enable Web Deploy on your deployment and be done. Then you can use Web Deploy to send the updates to your site without having to RDP. Just keep in mind that if for whatever reason the machine has to be moved or re-imaged (e.g. host updates) you'll lose your changes if they are not part of the Cloud Package (cspkg).
You can enable the option as part of the deployment of your Cloud Service.

File system issue when porting an ASP.NET application to Azure

I have an existing ASP.NET website that I would like to port to Azure within my free trial.
I would like the migration to be as painless as possible. The application uses log4net and NHibernate, plus it needs to share data with an application supposed to run on a virtual server.
Two questions can be asked as 1
How do I configure paths in Web.config to access a shared drive?
I need to configure the paths into which logs will be stored and, most important, I have to specify where the application will read the files written by the daemon that will run on my Azure Linux VM.
When both the app and the daemon ran on the same server (yes, I had Mono running fine) I just had to choose a shared local directory.
I'm not sure I'm totally understanding the scenario, but I'll try to give you a few options.
One - Windows Azure Web Sites (currently in Preview) could be a great option for your ASP.NET site. Of course, it depends what needs your site has. But, you can write your log4net files with web site and using NHibernate too.
Two - Web roles work great for situations like this. You would likely have to change some code to use blob storage for persistant file storage. You could use Windows Azure drives as a way to get a persistent location for log files. Windows Azure drives don't have a pre-determined drive letter, so you'd want to use the API to get to that. That may, or may not, be a good option for your situation. With web roles you could also write the log4net files to local storage and use Windows Azure diagnostics to transfer them periodically to blob storage. Just another way to persist the files.
Three - Using Windows Azure Virtual Machines (currently in Preview) you could write the log files to a data disk, which is backed by blob storage.
In the end, if you have files you need to share across instances and/or roles, then leveraging blob storage is likely your best option.

Resources