Windows April更新后,我的应用程序退出了提供静态文件的过程 [英] My app quits serving static files after the Windows April Update

查看:54
本文介绍了Windows April更新后,我的应用程序退出了提供静态文件的过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,其中Content文件夹由另一个构建前端应用程序的进程填充,而Visual Studio项目本身不知道该文件夹中的内容.我使用标准< staticContent> 节点和< modules runAllManagedModulesForAllRequests ="true"> 设置了web.config.我使用 routes.IgnoreRoute("content/*");

I have an app where the Content folder is filled by another process that builds a frontend app, and the Visual Studio project itself doesn't know what's in the folder. I set up the web.config with a standard <staticContent> node and <modules runAllManagedModulesForAllRequests="true">. I have my RouteConfig set up with routes.IgnoreRoute("content/*");

该应用程序通常与IIS Express一起运行,但我也已与IIS一起运行它.

The app typically runs with IIS Express, but I have also run it with IIS proper.

这一切都很好,可以直接从内容文件夹中加载js,css和其他静态文件.也就是说,直到我安装了Windows April更新.现在,每个单个静态文件请求都将生成404.如果我尝试转到请求的物理路径(但通过Exporer),则会得到该文件.文件在那里.部署该应用程序时,该应用程序可在Azure上运行,因此它必须是本地的.

This has all worked fine to load js, css, and other static files directly from the content folder. That is, up until I installed the Windows April update. Now every single static file request results in a 404. If I attempt to go to the physical path requested (but going through Exporer), I get the file. The files are there. The app works on Azure when I deploy it, so it must be something local.

这是我尝试过的:

  • 卸载IIS管理器和IIS Express,从 c:\ inetpub \ temp \ appPools 中删除appPools,然后重新安装IIS Express.
  • 删除staticContent节点并将runAllManagedModulesForAllRequests设置为false.
  • 授予对项目文件夹和子文件夹中每个人"的完全访问权限.
  • 关闭UAC.
  • Uninstalling both IIS Manager and IIS Express, removing the appPools from c:\inetpub\temp\appPools and reinstalling IIS Express.
  • Removing the staticContent node and setting runAllManagedModulesForAllRequests to false.
  • Giving full access to "Everybody" in the project folder and subfolders.
  • Turning off UAC.

可能是什么?我对Windows Update之后如何继续工作一无所知.

What could it be? I'm at a loss as to how to continue working after the Windows Update.

推荐答案

似乎更新过程以某种方式破坏了我的IIS安装.我执行了Windows Refresh,安装了所有工具,然后关闭了我的应用程序,一切正常.

It appears that the update process corrupted my IIS installation in some way. I performed a Windows Refresh, installed all my tools and pulled down my app and it works just fine.

很难或容易地解决,但几个小时后我又重新启动并运行.

Hardly a quick or easy fix, but I was up and running again after a few hours.

我找到了实际的问题以及解决方法.

I found the actual problem and how to fix it.

Windows April Update添加了一个漂亮的功能,您可以在其中为特定文件夹设置区分大小写的大小写.他们还做到了这一点,以使使用Linux子系统创建的所有文件夹默认情况下都区分大小写.缺省情况下,对cmd.exe或powershell.exe进行相同操作会禁用区分大小写.

The Windows April Update added a nifty feature where you can set case sensitivity on or off for specific folders. They also made it so that any folder created using the Linux Subsystem has case sensitivity turned on by default. Doing the same with cmd.exe or powershell.exe has case sensitivity off by default.

我的应用程序具有使用node/webpack构建的客户端部分,并将其放入.Net应用程序的Content文件夹中.当我执行Windows Refresh时,我最初使用cmd.exe构建了我的应用程序,并且运行良好.打开Linux子系统并使用bash构建应用程序后,我再次开始在Content文件夹中的所有文件上获取404.ProcMon.exe告诉我失败的文件是大写的(即,如果文件是modernizr.min.js,则IIS试图打开MODERNIZR.MIN.JS).我不确定为什么IIS试图以大写形式加载文件,除了IIS缓存文件时,它使用所有大写形式.

My app has the client portion built using node/webpack and put into the Content folder of the .Net application. When I did a Windows Refresh, I initially had built my app with cmd.exe and it worked fine. After I turned on the Linux Subsystem and built the app with bash, I started getting 404s on all of the files in the Content folder again. ProcMon.exe was telling me that the files that were failing were in uppercase (ie, if the file is modernizr.min.js, IIS was trying to open MODERNIZR.MIN.JS). I'm not sure why IIS was trying to load a file in all caps, other that the fact that when IIS caches a file, it uses all caps.

似乎只有在IIS从启用了区分大小写的文件夹中提供文件时才会发生此问题,默认情况下,在Linux子系统中创建的文件夹中会发生这种情况.

This problem seems to only happen when IIS is serving files from a folder with case sensitivity enabled, which happens by default with folders created in the Linux Subsystem.

编辑/etc/wsl.conf(如果不存在则创建)并添加以下内容:

Edit /etc/wsl.conf (create if it doesn't exist) and add the following:

[automount]
options="case=off"

您将需要退出终端,然后再次启动它,以进行更改.以前在bash中创建的所有文件夹都需要设置其标志,或者删除并重新创建.

You will need to exit the terminal and start it again for the changes to occur. Any folders previously created in bash will need to have their flags set, or be deleted and recreated.

这可以作为构建脚本的一部分添加,或者如果您不需要重复执行,则可以手工完成.您需要将执行策略设置为能够首先运行Powershell脚本.

This could be added as part of the build script or done by hand if you don't need to repeatedly do it. You'll need to set the execution policy to be able to run powershell scripts first.

Set-ExecutionPolicy remoteSigned

Powershell脚本(FixFolders.ps1):

Powershell Script (FixFolders.ps1):

param (
    [string]$root = $( Get-Location )
)

if ( Test-Path $root ) {

    $rootPath = $( Get-Item -Path $root )

    fsutil file setCaseSensitiveInfo $rootPath disable
    foreach ($path in Get-ChildItem -Path $rootPath -Directory -Recurse) {
        fsutil file setCaseSensitiveInfo $path.FullName disable
    }
}

此脚本将在指定的文件夹(或当前文件夹)和所有子文件夹上禁用区分大小写.

This script will disable case sensitivity on the specified folder (or current folder) and all subfolders.

FixFolders.ps1 将在当前文件夹和所有子文件夹上运行.

FixFolders.ps1 will run on the current folder and all subfolders.

FixFolders.ps1 c:\ dev 将在c:\ dev和所有子文件夹上运行.

FixFolders.ps1 c:\dev will run on c:\dev and all subfolders.

这篇关于Windows April更新后,我的应用程序退出了提供静态文件的过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆