- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 ASP.NET Core API 应用程序,它通过 HangFire 运行一些后台进程。其中一个过程包括将 csv 文件写入 wwwroot 文件夹,如下所示:
public async Task Work(PerformContext context)
{
var latestLikes = await this.likeRepository
.All()
.Select(l => new LatestLikesServiceModel
{
UserId = l.UserId,
BeatId = l.BeatId,
})
.ToListAsync();
var modelPath = this.webHostEnvironment.ContentRootPath + "\\dataModel.csv";
using (var writer = new StreamWriter(modelPath))
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
{
csv.WriteRecords(latestLikes);
}
}
在本地主机中它工作得很好,但是当我在 azure 中部署它时,HangFire 日志返回:"System.UnauthorizedAccessException","ExceptionMessage":"访问路径 'C:\home\site\wwwroot\dataModel.csv' 被拒绝。"
我该如何解决这个问题?
最佳答案
经过一周的研究,我终于找到了解决方案
我应该提到我使用 Azure DevOps 进行 CI 和 CD。
默认情况下,azure应用程序服务被部署为zip(这减少了对文件系统的直接访问)我所要做的是将部署方法更改为Web部署( Additional Deployment Options ),我终于可以访问该文件系统。更多描述信息请引用:
https://tomasherceg.com/blog/post/azure-app-service-cannot-create-directories-and-write-to-filesystem-when-deployed-using-azure-devops#comments
关于azure - .NET Core 应用程序中的 "Access to the path ' C :\\home\\site\\wwwroot\\dataModel. csv ' is denied.",部署在 Azure 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66813183/
我刚刚用全新的microsoft.aspnetcore.components.webassembly(s)..更新了一个项目从v5.0.5到v5.0.10。现在,当我重新编译时,我得到以下错误:。我到
我将我的 Asp.net core Blazor WebAssembly 应用程序更新到了 .net 6。一切都很好,但是从 github 操作进行的部署不起作用并抛出此错误: ... Copying
我将我的 Asp.net core Blazor WebAssembly 应用程序更新到了 .net 6。一切都很好,但是从 github 操作进行的部署不起作用并抛出此错误: ... Copying
我有两个 ASP.NET Core MVC 项目。这两个项目在它们的 wwwroot 文件夹中有相同的文件。 我的问题:是否可以为 wwwroot 文件夹指定一个自定义位置,以便我可以在两个项目中访问
我将图像存储在文件夹名称中 “图片”不在 wwwroot 文件夹中。 所以现在我无法访问它所以我的问题是 如何访问包含图像的文件夹,而该文件夹不是 wwwroot 的子文件夹?还是必须将这些文件放在
我正在这样做,它有效,但似乎有点黑客 using (var stream = new FileStream(@"d:\home\site\wwwroot\shared\...", FileMode.O
我正在使用下面的PS脚本,它将从Nexus下载Zip文件到Jenkins从属Windows服务器。(按预期工作) 我的另一个任务是将文件从Jenkins Windows服务器位置复制到另一个Windo
我正在开发一个 ASP.NET 核心应用程序,并使用 wwwroot/文件夹加载我的 css、javascript 等。 在我的 Visual Studio 元素中,我有以下结构: 但是,当我在 Ch
我有一个具有以下结构的 ASP.NET MVC 6 项目: project/ wwwroot/ custom/ project.json 我想从 custom 中提供文件,就好像它是一个虚
我的 index.html 位于名为 wwwroot 的目录中,可以通过 locahost:5001 上的浏览器访问它。当我使用 NPM 安装一些包时,目录 node_modules 被放置在与
假设我有这样的项目结构: - AppRunner | - Apprunner.csproj | - wwwroot - Tests | - Tests
这是我第一次尝试在我的 asp.net core 5.0 应用程序中运行 docker 镜像。我在 docker 文件中添加了以下配置。 FROM mcr.microsoft.com/dotnet/a
我正在研究一个项目结构,其中多个项目服务于同一组静态文件。 在开始时,每个项目都将同时提供静态文件和 API 服务,但稍后我计划将其中的一些分成多个项目。 ProjectA 将同时提供静态文件和 AP
当我在 Visual Studio 中使用“发布”部署到 Azure Web Apps 时,wwwroot 文件夹位于何处? 创建新实例时,wwwroot 文件夹来自哪里? wwwroot 是在 Az
我使用这个代码 move_uploaded_file($file_tmp,$us_id.".jpg"); 但运行此脚本后,它没有错误,但文件没有出现在文件夹中,怎么办? 在这些之前,我在本地主机中测试
我正在尝试将 zip 文件上传到 KUDU 以用于开发 Web 应用程序,并将文件提取到 wwwroot 文件夹的根目录 我使用的网址是https://webappname.scm.azurewebs
我已经部署了我的 Node.js 应用程序,它部署在 azure 应用程序服务中问题是我无法从 wwwroot/build 读取它我的所有 node.js 文件都位于 build 文件夹内我希望 Az
在我的 ColdFusion 应用程序中,我想将图像保存在这个文件夹中的 wwwroot 之外:C:\extSite\stdImages 我在 wwwroot\WEB-INF\jrun-web.xml
只是玩了一下。 我得到了一个包含 3 个项目的 Visual Studio 解决方案。 这三个都需要。 一个项目(“一个”)是应用程序的 UI。当然,它包含 wwwroot 中的静态文件。 我想对应用
我使用这个代码 move_uploaded_file($file_tmp,$us_id.".jpg"); 但运行此脚本后,它没有错误,但文件没有出现在文件夹中,怎么办? 在这些之前,我在本地主机中测试
我是一名优秀的程序员,十分优秀!