[英]CSS folder not found on IIS .net core wwwroot
Somehow I decided to build my web API and client separately after several hours failed to combine .net core 2.2 with vue+vuetify. 经过数小时未能将.net core 2.2与vue + vuetify结合使用后,我决定以某种方式分别构建Web API和客户端。
I build the client using Vue CLI, with this config: 我使用以下配置使用Vue CLI构建客户端:
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/joblist/' : '/',
}
Then place the content of dist
folder to wwwroot
folder on .net core project, I use below code to enable UseStaticFiles
: 然后将
dist
文件夹的内容放置到.net核心项目上的wwwroot
文件夹中,我使用以下代码启用UseStaticFiles
:
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseHsts();
}
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseMvc();
}
Everything looks perfect when I debug with APP URL set to http://localhost:49602/joblist
. 当我使用设置为
http://localhost:49602/joblist
APP URL进行调试时,一切看起来都很完美。 But somehow when I publish to my Server, which is myserver/joblist
, the server can't serve EVERYTHING placed inside wwwroot/css
folder, so the site looks ugly. 但不知何故,当我发布到我的服务器,它是
myserver/joblist
,服务器不能提供一切放在里面wwwroot/css
文件夹,因此该网站看起来丑陋。
At first, I thought the problem is the wwwroot path or something like that, but I can browse to wwwroot/js
folder perfectly, so I try to rename wwwroot/css
folder to wwwroot/notcss
, the site works perfectly this time. 起初,我认为问题出在wwwroot路径或类似的路径上,但是我可以完美浏览到
wwwroot/js
文件夹,因此我尝试将wwwroot/css
文件夹重命名为wwwroot/notcss
,这次站点可以正常运行了。
Can anybody help me with this problem? 有人可以帮我解决这个问题吗?
UPDATE: 更新:
wwwroot/css
and wwwroot/js
is perfectly exist on the server. wwwroot/css
和wwwroot/js
完全存在于服务器上。 wwwroot/js
folder but can not open any file inside wwwroot/css
folder. wwwroot/js
文件夹内的任何文件,但不能打开wwwroot/css
文件夹内的任何文件。 wwwroot/notcss
(can be any) then replace any /css/*
reference in index.html
file to /notcss/*
wwwroot/notcss
的硬链接(可以是任意链接),然后将index.html
文件中的所有/css/*
引用替换为/notcss/*
UPDATE 2 更新2
Here is the error I received on the browser when browse on one of any file in CSS folder 这是在CSS文件夹中的任何文件之一上浏览时在浏览器上收到的错误
HTTP Error 404.0 - Not Found
HTTP错误404.0-找不到
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
您要查找的资源已被删除,名称已更改或暂时不可用。
Detailed Error Information:
详细错误信息:
Module IIS Web Core Notification MapRequestHandler Handler StaticFile Error Code 0x80070002 Requested URL http://localhost:80/joblist/css/app.14044b2f.css Physical Path C:\\inetpub\\wwwroot\\joblist\\css\\app.14044b2f.css Logon Method Anonymous Logon User Anonymous
There must be any some misscongured config, try to browse to C:\\Windows\\System32\\inetsrv\\config
on your server, looks for a file named applicationHost.config
open the file then search for css
text. 必须有任何配置错误的配置,尝试浏览到服务器上的
C:\\Windows\\System32\\inetsrv\\config
,查找名为applicationHost.config
的文件,打开该文件,然后搜索css
文本。 if you see some suspicious config just delete it, don't forget to backup it first. 如果您看到一些可疑的配置,只需删除它,别忘了先备份它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.