使用Docker组成的ASP.NET核心项目中未加载静态资源。

问题描述 投票:0回答:0
我最近已经安装了FNOS(NAS OS),现在我在使用Docker功能时面对静态文件。

logs.enter image description here中的eRror

Request reached the end of the middleware pipeline without being handled by application code. Request path: GET http://***.tpddns.cn:10241/js/site.js, Response status code: 404

.yaml

version: '3.4'

services:
  ywh:
    image: mcr.microsoft.com/dotnet/samples:aspnetapp
    ports:
      - "8091:80"
    volumes:
      - /vol1/1000/docker/publish:/app
      - /vol1/1000/docker/publish/wwwroot:/app/wwwroot 
    environment:
      ASPNETCORE_URLS: http://+:80
    entrypoint: ["dotnet", "/app/YWH.dll"]

我还检查了 /应用程序夹,所有内容都在那里。

我还仔细检查了发布文件,并通过Dotnet CLI或VS2022在我的Windows计算机中运行它,也可以很好地运行。因此,我认为这不是ASP.NET核心问题。因此,请不要为此线程添加

asp.net-core标签。 enter image description here通过方式,我刚刚使用基本模板创建了Web应用程序,我只是将.mp3文件放在wwwroot

文件夹下。 提前对任何帮助都表示赞赏。

您应该仅登录一个文件夹,特别是主要发布目录。尝试此.YAML代码:

version: '3.4' services: ywh: image: mcr.microsoft.com/dotnet/samples:aspnetapp ports: - "8091:80" volumes: - /vol1/1000/docker/publish:/app environment: ASPNETCORE_URLS: http://+:80 entrypoint: ["dotnet", "/app/YWH.dll"]

	

docker docker-compose
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.