访问 SCD 中的静态文件 [英] Accessing static files in SCD

查看:33
本文介绍了访问 SCD 中的静态文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.NET CORE 应用程序中,我使用 wwwroot 文件夹中的静态文件.当它作为 dotnet run 运行时,index.html 文件在 localhost:port/ 处显示流畅且正常,但在将应用程序发布为 后>SCD自带开发包,运行.exe生成文件,静态文件localhost:port/.

In the .NET CORE application, I'm using static files in wwwroot folder. while running it as dotnet run the index.html file is displayed smoothly and normal at localhost:port/ but after publishing the app as SCD self-contained development package, and run the .exe generated file, the static files are not displayed at the localhost:port/.

在浏览器的开发者屏幕中,我收到404 error,即找不到文件.

In the developer screen of the browser, I got 404 error that is file not found.

推荐答案

在你的project.json中添加相应的语句:

Add the corresponding statement in your project.json:

  "publishOptions": {
    "include": [
      "wwwroot",
      "appsettings.json",
      "web.config"
    ]
  },

这篇关于访问 SCD 中的静态文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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