如何以及在何处存储部署在 Azure Web 应用程序中的 ASP.NET MVC 应用程序的文件
我正在 .NET 4.7.2 上创建 ASP.NET MVC 应用程序。一项功能是用户上传文件,该文件暂时保存在本地文件夹 c:/ 中。提取数据后,文件将上传到 Azure 存储容器,临时文件夹将被清空。
我的问题是,当应用程序在 Azure Web App 中生产时,我应该将文件临时存储在哪里?部署到 Web 应用服务后。我收到错误,因为找不到路径。
请注意,将文件存储在 c:/临时文件夹中并不是必需的功能。只是不确定在上传到 Azure blob 之前如何处理该文件。
I am creating an ASP.NET MVC app on .NET 4.7.2. One functionality is that the user would uploads the file which saves the file in the local folder c:/temporarily. Once the data is extracted, the file would be uploaded to the Azure storage container and the temporary folder would be emptied.
My question is when the app is in production in Azure Web App where should I store the file temporarily? After deployment to Web App service. I am getting error because the path is not found.
Note that storing the file in c:/temporarily folder is not the required functionality. Just not sure how to handle the file prior to uploading to Azure blob.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了答案, blob.Upload 是重载方法,它也接受文件流以及“文件路径+文件名”。因此,我没有使用临时存储文件,而是使用采用 filestream 参数的方法。
注意:下面的代码没有使用异步方法,但可以使用它。 blob.UploadAsync(..)
I found the answer, the blob.Upload is overloaded method which also takes the file stream as well as "file path+file name". So rather than to store the file temporarily I used the method that takes the filestream parameter.
Note: The code below does not use the async method but one can use it. blob.UploadAsync(..)