Azure function - location of 'azure-functions-host' folder - azure

I have developed Azure Function which uses log4net for logging and it is configured via file.
Locally it works okay, but when I deploy it on Azure I receive error: System.Private.CoreLib: Could not find file '/azure-functions-host/log4net.config'
I am using Linux App Service and I'm unable to find folder 'azure-functions-host' on the file system.

From the function app, the log4net is to be initialized using the repository object as shown in this example. And also, if linux is used for hosting the App Service, then the path for the log file to be set as "/home/site/wwwroot/Log4Net/function.log"

Related

Azure Linux Web App Service - System.IO.IOException: Readonly File Error

The web app already running on .NET Core 3.1 LTS with IIS (windows server 2019)
Recently, I deployed as an Azure Web App Service but I encountered a file write error.
The application trying to create a new file for some business requirement.
Error message; System.IO.IOException: Read-only file system
Has anyone encountered this problem on Azure Linux Web App?
Solved: The Azure Linux Web App Service doesn't support directly file uploading to a regular folder under the wwwRoot. If you can running on the linux web app service, you need to use blob / storage etc..
Azure web app recommends that the wwwroot folder has read and write permissions. Whether it's Linux or Windows, it's the same.
In addition, it is not recommended to put the content of file operations in the project directory. For example, excel files generated under a certain business or uploaded image files in the deployment file. And the files are recommended to be stored in azure storage.
From the information which you have provided we can understand that there is any issue in creating a file in a specific directory where you don’t have access to it.
Refer to this SO thread where we got the insights to disable read-only mode, thanks to MarkXA.
Make sure that you have provided correct path whether it is any storage account or local storage where you are getting files. Also, if possible, elaborate your questions with full error trace, path you are using to access.

Console app converted to Azure Webjob not able to wite to a file location mentioned in app.config

I'm converting a console app running on a windows server to an Azure Web job. This console application has references to the .txt log file location in app.config.
I was able to deploy the webjob, but when I run the webjob, I get the below error as the webjob is not able to get to this path, which is on the server.
Access to the path 'C:\Jobs\logs\Log 4_27_2020.txt' is denied.
What is the solution for this ?
Also, the same console app also has the file layout defined in .xml format as:
How can I get the webjob to reference this location?
Thanks!!
You can't write to the C drive. The folder structure starts at D:\home and is mapped to the %HOME% environment variable.
Understanding the Azure App Service file system

How FTP deploy .NET Core WebApp to Azure Linux App Service plan

I want do deploy code to Linux App service plan over FTP but I fail because I am missing a step how to "say to app service to use app DLL instead of default one".
Code is copied, I even uploaded test zip file and I can't download it, getting error 404 so how did Microsoft imagine to deploy code over FTP? I couldn't find any info in their documentation regarding this exact case.
I want to avoid using docker file, If this can't be done I'll simply switch to using Windows based App service plan.
In application setting screen of your WebApp mention the startup file name
dotnet

Failed to publish virtual application to Azure

I have two asp.net core 2.0 projects in the same solution, that I would like to be deployed on the same Azure Application service.
Following this tutorial, I can successfully deploy the first project and add the virtual application path to the second as can be seen:
The problem is that when I try to deploy the second project I get the following error :
(9/6/2017 10:25:35 AM) An error occurred when the request was processed on the remote computer.
Could not find a part of the path 'D:\home\site\api\App_Offline.htm'.
It looks like it's not creating the virtual application and directory. Any ideias? I've already seen that the directory must match your project name (tried with that and also failed), that it should be site\wwwroot\projectName. What am I missing?
I can reproduce the issue on my side when I deploy my web application to virtual application.
If I manually create physical path for virtual application before deployment, I can deploy the app without this issue, you can try it.
Create Api folder
Publish result

FTP'ing a Suave app to Azure

Having never used Azure before I'm attempting to deploy a simple F# Suave app to Azure using FTP. Ultimately I want to deploy via github but I initially thought FTP'ing it would be the easy first step. According to https://suave.io/azure-app-service.html it should be straight forward.
These are the steps I followed
Created a new web app in Azure including a resource group
and app service plan. All on the Free Tier.
Downloaded the publishsettings XML file that Azure created.
Cloned this repo: https://github.com/isaacabraham/fsharp-demonstrator
Used FileZilla to connect via FTP using the creds
from step 2.
Uploaded the files (via FTP) from
fsharp-demonstrator/src/SuaveHost (which includes the necessary web.config file) from the repo cloned at step 3 to
the site\wwwroot on Azure.
Navigated to Azure site url.
Then I receive the error:
The specified CGI application encountered an error and the server terminated the process.
(When I look at the folders on Azure under site\wwwroot I don't see any obj or bin folders. I don't think any msbuild process occurred. That doesn't seem right.)
Anybody got any idea what the problem is?
I suspect the issue is that when you deploy via FTP, then Azure does not automatically run the deploy script specified in the .deployment file.
The build.fsx script uses Kudu service to deploy the built files, so it might be easier to just use Github deployment rather than FTP - this way, Azure will do the deployment for you.
If you want to deploy via FTP, you'll need to build the project locally and upload the output. I'm not sure how to best do this with Isaac's Kudu-based demo though (ultimately, you need web.config that points to your built executable like this)

Resources