托管在Azure上时找不到位于我的根项目文件夹中的文件 [英] Unable to find files located in my root project folder when hosted on Azure

查看:74
本文介绍了托管在Azure上时找不到位于我的根项目文件夹中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到位于Blazor Client WebAssembly项目的根项目中的文件.当它在我的计算机上本地执行时可以运行,但是在Azure上托管时不起作用.

I tried to find files located in the root project of my Blazor Client WebAssembly project. While it works when executed locally on my computer, it doesn't work when hosted on Azure.

在本地执行时,我得到了1

When executed locally, I got 1

在Azure上执行时,我得到0(没有访问被拒绝之类的错误)

When executed on Azure, I got 0 (no access denied errors of things like that)

为了更加完整,我将需要一些文件来填充初始的空白数据库.

To be more complete, I will have some files needed to fill an initial blank database.

如果我无法访问项目文件夹中的文件,则将使用Blob Azure存储.我想澄清一下,这只是我自己的测试项目.

If I cannot access files in the project folder, then I will go for a Blob Azure Storage. I would like to clarify that this is only a test project for myself.

推荐答案

此问题的原因是在发布时未包含TextFile.txt文件.

The reason for this problem is that the TextFile.txt file was not included at the time of publication.

阿科斯说的是对的.我正在修改.csproj文件以发送我的答案.可以更好地帮助论坛的其他用户.

Akos said is right. I am modifying the .csproj file to send out my answer. Can better help other users of the forum.

您可以将代码粘贴到您的.csproj文件中.

You can paste code in your .csproj file.

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <ResolvedFileToPublish Include="TextFile.txt">
      <RelativePath>TextFile.txt</RelativePath>
    </ResolvedFileToPublish>
  </ItemGroup>
</Project>

然后,您可以部署您的应用程序.您可以在D:\home\site\wwwroot>下找到TextFile.txt.

Then you can deploy your app. You can find TextFile.txt under D:\home\site\wwwroot>.

这篇关于托管在Azure上时找不到位于我的根项目文件夹中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆