【发布时间】:2020-09-02 16:13:08
【问题描述】:
在为 Angular 应用程序开发 Web API 时,我已将图像保存在我的 Web Api 项目中,项目文件夹结构如下。
现在,当我尝试通过浏览器访问该图像时,它没有显示图像,这里是它的快照。
我试过像下面这样调用 Angular 的 HTML 页面。
<img src="http://localhost:4000/Uploads/Profile/057f4ed8-5b52-4ba0-b3ec-ae3b4f4e9baa.jpg" class="img-fluid">
如何在我的其他项目中访问这些图像并且 Web API 项目正在运行。
【问题讨论】:
-
我们需要看看你是如何提供图片的
-
@robinsax 怎么样 .. ?我一直在为 api 使用 Visual Studio 代码。但是当我为 API 运行 Visual Studio 2019 时,它会显示存储在路径中的图像
-
正如我在 Visual Studio 代码中看到的那样,没有创建 wwwroot 文件夹,并且它仍然没有通过路径访问图像,但是如果我在 Visual Studio 2019 .Net Core 项目中创建,我仍然不能只有当我在 wwwroot 文件夹中使用它。
标签: asp.net-web-api c#-4.0 .net-core visual-studio-code localhost