简体   繁体   English

在IIS .net核心wwwroot上找不到CSS文件夹

[英]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: 更新:

  • The wwwroot/css and wwwroot/js is perfectly exist on the server. wwwroot/csswwwroot/js 完全存在于服务器上。
  • I can open any file inside wwwroot/js folder but can not open any file inside wwwroot/css folder. 可以打开wwwroot/js文件夹内的任何文件,但不能打开wwwroot/css文件夹内的任何文件。
  • 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/* 目前,我使用一种解决方法,方法是创建一个名为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.

相关问题 IIS 部署不能在 asp.net core 2.2 razor 页面中包含 wwwroot 文件夹的文件 - IIS deployment cannot contains files for wwwroot folder in asp.net core 2.2 razor pages 更新到 Asp.Net Core 3 的 Identity 项目提供了 wwwroot 文件夹 - Identity project updated to Asp.Net Core 3 gives wwwroot folder 文件上传到ASP.NET Core中的wwwroot文件夹 - File upload to wwwroot folder in ASP.NET Core 如何更改 .NET Core 项目中“wwwroot”文件夹的图标? - How do you change the icon of the `wwwroot` folder in a .NET Core project? .Net Core+React项目如何创建wwwroot文件夹? - How to create a wwwroot folder in .Net Core+React project? 在ASP.NET 4.5项目中使用wwwroot文件夹(ASP.NET Core样式) - Using a wwwroot folder (ASP.NET Core style) in ASP.NET 4.5 project 将“react js”构建到我的“asp.net core web api”的 wwwroot 文件夹时出现路由问题 - Routing problem when building "react js" to wwwroot folder of my "asp.net core web api" 上载到ASP.NET Core API中的WWWRoot文件夹需要什么权限 - What permissions are required to upload to WWWRoot folder in ASP.NET Core API 在Rasperry Pi上对dockerize .net core mvc应用程序进行Docker化后,wwwroot文件夹中没有静态文件 - No static files from the wwwroot folder after dockerize .net core mvc application on Rasperry Pi “wwwroot”文件夹中的某些文件未在 ASP.NET 核心 web 部署中发布 - Some files in "wwwroot" folder are not published in ASP.NET Core web deploy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM