Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
354 views
in Technique[技术] by (71.8m points)

c# - How do I store file uploads of a .Net core web application on Azure

We are using GitHub Workflow to deploy a C# .Net Core web application on Azure. The web application consists of a file upload feature which stores file in the file system in local system during development, which saves the file in a child directory (Documents) of the wwwroot directory and is accessible to the client with a link for each file, eg. /Documents/foo.pdf

Unfortunately this doesn't seem to work as is on Azure after deployment.

After some research, I found that Azure file share is the way to go. How do I access the file stored in Azure file share from the web application with a link? Or if it is possible to store the file as in the local development, then how can it be done?

Appreciate any suggestion.

question from:https://stackoverflow.com/questions/65902938/how-do-i-store-file-uploads-of-a-net-core-web-application-on-azure

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You should modify .csproj file, then deploy your app.

I create Html folder, then deploy directly with no change in .csproj file.

I found no Html folder like below.

enter image description here

Add below code in .csproj file.

<ItemGroup>
   <Content Include="Html**">
     <CopyToOutputDirectory>Always</CopyToOutputDirectory>
   </Content>
</ItemGroup>

Then deploy.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...