Somehow I decided to build my web API and client separately after several hours failed to combine .net core 2.2 with vue+vuetify.
I build the client using Vue CLI, with this config:
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
:
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
. 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.
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.
Can anybody help me with this problem?
UPDATE:
- The
wwwroot/css
andwwwroot/js
is perfectly exist on the server. - I can open any file inside
wwwroot/js
folder but can not open any file insidewwwroot/css
folder. - For now, I use a workaround by creating a hard link named
wwwroot/notcss
(can be any) then replace any/css/*
reference inindex.html
file to/notcss/*
UPDATE 2
Here is the error I received on the browser when browse on one of any file in CSS folder
HTTP Error 404.0 - Not Found
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
wwwroot/css
?404 - File or directory not found.
{your web site base path}/css
404 - File or directory not found.
css
folder actually created on the server? What if you directory-list{your web site base path}/js
?