How to save file using Azure/Web API to folder on shared network drive - c#

Currently trying to save a file to a folder on a network location.
network//location//folder/save-here
The WebAPI is connected though azure/VPN /Entity Framework, however I need to save the file on the protected network location, not just a record in the database.
I've started trying to use a Hybrid Connection, however I'm not sure it will help solve this issue.
What is the best way to achieve saving a file to a folder on a network location from a Web API/Azure?

Unfortunately, in the Application Service Plan you cannot mount a file share.
If you were using Azure's file share from Azure Storage, you could just save the file using the API. However, since you are trying to save to an on-prem file share, you might need to set up some kind of service (possibly another API) running on-prem than you would call and it would be able to save the file for you.

Related

Using an Excel file from onedrive in c#

So I'm trying to make a program that uses an excel file to get some data.
I'm trying to make it so i can update data while the application is running, but i have no clue on how to get the file from onedrive.
The application is running c# .net 6. Reading the data from a local path is no issue.
I want to know if there is a better way than onedrive, or how i would read the excel data.
Scenario: The application will run on a remote server. I need to update the excel file from my own pc. I would rather have the file locally and have onedrive automatically syncing it on the machine, than having to remote desktop to the server.
UPDATE:
I've now tried troubleshooting and it seems like the path can't be found. I've written the path in console to see if it uses the correct path on the server as well, when using path in file explorer, i go directly to the file.
So having this issue i was not thinking about the posibility of not having the rights to access the file.
To fix the issue i had to go into application pools and then edit the application pool i was using, for that service, to a user having rights to the folder it tried to access.

How can I copy files from Azure File storage to my local machine every 2 hours (periodically)?

Please suggest the best way to I copy data from Azure File storage to local machines every 2 hours (periodically). Can we write a C# exe to do that and deploy it on the PC?
Write a desktop application in any language with the SDK support of Azure File Storage. Within that application, create a timer to do your download through the API.
If the there are configurable settings or user interactions needed, I'd say go for a desktop application.
Otherwise, and if your clients are windows PCs, best way would be to write a windows service that does the job.
You perhaps could use Azure Logic Apps - if you set a job to run periodically and copy files from File Storage to OneDrive, for example, then OneDrive would replicate your files onto a on-premise server.

Bulk upload large number of files to Azure from local file system

What is the best way for an admin user of a website to upload 10,000+ images spread across 2,000 sub-directories?
I have a c# MVC .Net web app where 4 times a year the business need to replace 10,000+ images. They have them on a network share, there is 1 parent directory, and then around 2,000 sub-directories underneath, each housing multiple image files.
I know how to do write to BLOB storage, parallel Tasks, etc., but how can the app running on Azure navigate the client side local file storage to find all the files in the sub-directories to upload them?
You can run AzCopy tool on the local network where the local files are, and use the /S flag to copy the files in a subfolder: Upload all blobs in a folder
In my opinion, I suggest you could directly write a command-line code or exe for the client admin to upload file.
Since our web app have no permission to access client's resources.If you want your web app access the client resources, you need use special ways like Relay Hybrid Connections or VNET.
It also need the client admin to config the client machine to allow the azure web app access.
In my opinion, the most easily way you could write a exe(it will auto upload the file to azure storage using datamovement library) which will run by the scheduled job in the client-side.

Uploading Files to Two Web Front End Servers - how to consolidate into one location?

I have built a web application which uses two web front end servers, the Users are randomly directed to either one through the same URL. The web app has specific functionality to upload and download files. When a file is uploaded, it is stored on a specific directory on the server to which it is uploaded.
The issue is that when a User uploads a file to the folder on Server 1, any user trying to download that same file from Server 2 will not be able to as it only exists on the server where it was uploaded.
What's the best way of solving this? I've looking at:
- Using a SAN, problem here is I don't want to change or create a domain
- Writing a Windows Service, would prefer to avoid this if possible, I've not done it before but will give it a go if necessary
Thanks in advance!
Joe
Unless I'm missing something very obvious, all you need is a shared location. This could be a network share addressed through a UNC path, a folder on an FTP server, a database, anything at all, as long as it's
shared,
accessible from both web-servers
web-application service account has read/write permissions to it.
From your requirements a network share on a file server (perhaps 1 of the 2 web-servers, or the load-balancer, or (ideally) a new server entirely) would be the simplest method.

physical path in silverlight

I need to get physical path in silverlight. I'm using WCF service, I created one folder called 'Myfolder'. So I need to get the path of myfolder Please help me.
Silverlight doesn't allow direct access to the file system. However you can take advantage of Isolated Storage to read and write files on the client side. Here is a tutorial for that.
If you need access to a folder in the web application that is hosting your Silverlight app, use your service. Once you are in your OperationContract method, or even if you leverage the WebClient to make an AJAX style request, you can access the file system on the server but remember that is a different machine than your Silverilght client with the exception of when you do development (or browse your app on the server).

Categories