5

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 and wwwroot/js is perfectly exist on the server.
  • I can open any file inside wwwroot/js folder but can not open any file inside wwwroot/css folder.
  • For now, I use a workaround by creating a hard link named wwwroot/notcss (can be any) then replace any /css/* reference in index.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
12
  • What does the browser get as a response when requesting a file in wwwroot/css? Commented Apr 15, 2019 at 3:55
  • 404 - File or directory not found.
    – SIRS
    Commented Apr 15, 2019 at 3:58
  • Try enabling directory listing and see what you get when you request {your web site base path}/css Commented Apr 15, 2019 at 4:01
  • same, 404 - File or directory not found.
    – SIRS
    Commented Apr 15, 2019 at 4:21
  • Is the css folder actually created on the server? What if you directory-list {your web site base path}/js? Commented Apr 15, 2019 at 4:59

1 Answer 1

5
+50

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. if you see some suspicious config just delete it, don't forget to backup it first.

1
  • I decided to look at the file you meant, and yes there is some config for 'wwwroot/css' folder, I delete it then everything is normal after it. thanks
    – SIRS
    Commented Apr 23, 2019 at 0:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.