Set permissions to folder on Azure Webservices (ASp.NET MVC) - c#

I have ASP.NET app
I host it on Azure using Web App Service
I have uploads folder where I write videos.
Videos writes well, but when I try to read it and display on View I have this error
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
I think error in permissions.
I connect to website using IIS Manager
But I don't understood how get read/write property to uploads folder.
Here is my website structure
How I can set permissions on Web App Services?

Related

ASP.NET Core 5 API write files on Azure Web App disk space

I do have an ASP.NET Core 5 Web API project which is currently hosted as an Azure Web App on a Windows App Service plan. Since I have a couple of gigabytes of storage associated with the App Service plan, I want to use 10 GB for an image cache where I store images generated from the API.
Here is some context:
I don't want to use Azure Storage / Blob Storage for this to avoid unnecessary traffic costs and delays. Some images are generated from multiple layers of other images (let's call them intermediate images) and I cache everything.
My caching solution works fine locally, but currently not on Azure.
I want to use 'Remove additional files at destination' when publishing a new version of my API.
The cache will be cleared/invalidated via an API call, not on deployment or app restart.
As I've said, the caching works fine if I run at locally on IIS Express. As far as I know, the Windows App Service plan uses Kestrel for hosting. I'm looking for a storage path within the Azure Web App, where I can create and delete directories + create/read/delete files.
Since the App Service Plan is B1, the App Service plan is running on a dedicated Azure VM, according to the docs: https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans
From https://learn.microsoft.com/en-us/azure/app-service/operating-system-functionality, I've learned that there is a C drive and a D drive as well.
From my web app, I can select Development Tools -> Advances Tools -> Go to see Kudu. When I click on Environment in Kudu, I can see some absolute paths that I've tried to write to without success. I've also tried to access
Environment.GetEnvironmentVariable("HOME")
IWebHostEnvironment.WebRootPath
IWebHostEnvironment.ContentRootPath
"D:\home\site\wwwroot"
"D:\home\"
without success as well.
I also tried to add a virtual directory (since I want to store images in another directory to be able to use the 'remove additional files on destination' option). I also connected via FTP to /site/wwwroot/ where I can see my deployed application.
In the past, I was able to read files from a virtual directory from an ASP.NET Webforms application, but with this ASP.NET Core 5 API project, I didn't have any success mapping relative paths to absolute paths.
My main question is: What absolute path to I need to use in my API project to have create/delete directory permissions and create/read/delete file permission into my Azure Web App?
Okay, I've figured it out. I had some fatal errors when starting the application. It seems that they were related to ApplicationInsights. I removed it completly from the Azure Web Portal and now everything works.
The following path works as a base path D:\\home\\

Installing Wordpress in a Sub Directory in windows server along with asp.net

I have deployed asp.net based website to domain e.g xyz.com.
I want to manage the blog site of the website via WordPress cms. So I have created a folder by the name of "blog" in the base directory and installed WordPress in it. WordPress installation is working fine on the local host. But when I try to access it via domain link xyz.com/blog it gives 404 error because every request is managed by asp.net MVC. I want to ignore the xyz.com/blog route not to be managed by asp.net MVC.
I am not sure where I should do that kind of configuration in IIS or any rules rewrite.
Because you are getting 404 error, Can you please check your ASP.NET Applications Directory Browsing Settings. Please enable it and check again. Moreover Sometimes due to Application Pool (Integrated/Classic) you may get this type of error.

Access FTP Hosted Web API in C#

I have created a Web API in ASP.NET. I deployed this API in Azure Web App and I was able to use controllers from web API like this http://.azurewebsites.net/api/{controller}.
Now I have deployed the Web API on an FTP server and I am unable to access my controllers like I did before. Any idea on how to do it?
I would really appreciate your help as I am new to FTP.
Thanks in advance.
Just because you can upload/deploy an asp.net site via FTP, it does not mean that the server can automatically run the site and start serving those endpoints (/api/{controller}) automatically.
You need to clarify with whoever is hosting your FTP server if such server can also host asp.net websites. If so, you need to ask them in what particular folder within that server you need to upload your site to.

How to transfer folder from Amazon Web Services to ASP.NET Server remotely

I have a folder on Amazon Web services and I want to transfer it to ASP.NET Server.
The Folder has huge size and I have a limited internet capacity so I can't download it and re-upload it via ASP.NET Web Forms.
so is it possible ? and How could I do it ? or What I should search for this ?
P.S: as I searched all I found was the other way around and I didn't quite understand it.
If you have folder on EC2 you can do scp [unix command to copy files from Linux to linux]
if you have it on S3; you can expose it as public folder; and then on Azure you can download it using wget/curl
I found a service that do the exact thing I want via FTP.
As the user registers two FTPs and he can copy/migraine the files/folders you want from one to the other.
Multcloud: Manage, migrate, transfer, copy, and move files between any cloud storage services.

Reading files from wcf services

Hello I am new to web services using WCF,how can I read files stored in a local directory inside my WCF application, I want to be able to read files inside my service application into my client application
I do not want to download files but view them In my client web application, I tried using HttpContext.Current.Server.MapPath(path) but my client website states directory not found since it is looking on local directory of the website
Thank you.
reading file in WCF service is just like other projects.
you can use File.ReadAllBytes or File.OpenRead.
note: you have to set appropriate permissions.

Categories