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
Community
  • 1
  • 1
SIRS
  • 624
  • 6
  • 20
  • What does the browser get as a response when requesting a file in `wwwroot/css`? – Frank Fajardo Apr 15 '19 at 03:55
  • `404 - File or directory not found.` – SIRS Apr 15 '19 at 03:58
  • Try enabling directory listing and see what you get when you request `{your web site base path}/css` – Frank Fajardo Apr 15 '19 at 04:01
  • same, `404 - File or directory not found.` – SIRS Apr 15 '19 at 04:21
  • Is the `css` folder actually created on the server? What if you directory-list `{your web site base path}/js`? – Frank Fajardo Apr 15 '19 at 04:59
  • yes, `ccs` folder is exist on the server, but I can not open ANY file placed inside css folder, even though I can open ANY file placed on ANY folder beside `css` folder – SIRS Apr 15 '19 at 05:07
  • Wich version of Vue CLI ? 2 or 3 ? – Toodoo Apr 16 '19 at 09:34
  • Does this repro without using IIS? – Justin Kotalik Apr 19 '19 at 00:31
  • No, actually maybe the problem is IIS on my server, because when I debug it using VS, it ran without any problem, even though VS it self is using IIS Express as far as I know. – SIRS Apr 19 '19 at 01:50
  • @anand_v.singh do you read my question? – SIRS Apr 19 '19 at 06:07
  • You said the problem is in your IIS server probably, since it is working properly on IIS express in a comment above, thus the comment, a common problem when IIS express works and IIS doesn't is you don't have all features activated that are required, have seen that quite a few times, but doesn't look like you are looking for that advice, hence I am happily deleting that comment. – anand_v.singh Apr 19 '19 at 07:40
  • @anand_v.singh if Static File is not enabled in my server, then I will not be able to browse to `wwwroot/js` folder, as stated in my question above. I will repeat my probrem, I (ONLY) can not browse `wwwroot/css` folder. – SIRS Apr 20 '19 at 00:20

1 Answers1

5

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.

nyongrand
  • 618
  • 10
  • 24
  • 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 Apr 23 '19 at 00:27