I have created a web api with c# .net core 3.1 and I use a directory to save generated invoices there. the path to the directory on my local machine is C:\CU World\Backend\CU-API\CU-API\Generated Invoices\
On my local machine the api works fine. But on my linux server it does not work... I'm getting this error:
I do not understand why I am getting this error when I publish this to linux server with apache2 installed on it. Can somebody help me, and expain me how to fix it?
CodePudding user response:
I could fix it by adding this to my Startp.cs
var fileProviderPath = Environment.GetEnvironmentVariable("FILE_PROVIDER_PATH");
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(fileProviderPath),
RequestPath = "/GeneratedInvoices"
});