我与这条路的动作中检索index.html文件:脚本/样式表链接从wwwroot的回报担任404
/services/parts/{number}
从wwwroot文件夹
...
return ContentResult(html, "text/html");
在wwwroot文件夹我有这样的结构:
wwwroot
|
---services
|
---parts
|
---1
|
---index.html
|
---2
|
---index.html
// and so on 3,4, ...
因为我s在检索index.file并返回它是没有问题的,但是index.html文件中嵌入的所有链接/脚本无法加载,所以我得到这些链接的404。
然后我检查为什么为每个链接404:
请求的URL:URL:http://localhost:60000/services/parts/2/~/styles/vendor/bootstrap.min.css
在index.html的样式表链接:
<link rel="stylesheet" type="text/css" href="~/styles/vendor/bootstrap.min.css">
更改样式表链接:
<link rel="stylesheet" type="text/css" href="styles/vendor/bootstrap.min.css">
结果在请求的网址,没有大的变化...
Requested url: URL:http://localhost:60000/services/parts/2/styles/vendor/bootstrap.min.css
为什么在asp.net核心框架尝试从路线服务/配件/ 2,而不是从款式/供应商的文件夹中的wwwroot文件夹下的子文件夹被下载bootstrap.min.css?
我该如何解决这个问题?
太棒了!新年快乐:-) – Pascal
奇怪...它停止工作,没有任何改变...所有CSS文件的路径是正确的url http:// localhost:56071/styles/vendor/bootstrap.min.css我得到一个404.但是该文件正好放在wwwroot的路径中。 – Pascal