4

If I use bash (from Ubuntu 18.04 running via Windows Subsystem for Linux) to create a directory under my Windows profile:

$ mkdir /mnt/c/Users/mdmower/source/repos/WebBash

then IIS 10 is unable to read Web.config directly under that directory. As a minimal example, try putting this simple Web.config into a directory created by Windows Explorer as well as another directory created by bash:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <clear />
    </handlers>
  </system.webServer>
</configuration>

Now, add a website in IIS 10 that points to the directory created in Windows. After adding the website, visit the Handlers Mapping section. You should see it is cleared out (this is the sole function of the sample Web.config). Change the source directory of the website to the directory created in bash. The Handlers Mapping section is no longer cleared.

While I would normally assume this is due to permissions, I cannot find a single difference in each directory's security settings (Properties > Security > Advanced). The unix permissions – which shouldn't matter anyways – are also identical for the two directories (drwxrwxrwx). PowerShell's Get-ItemProperty reports that both directories have the same mode (d-----) and no LinkType.

Why can't IIS 10 read from the directory created with bash?

Software versions:
Windows 10 x64 Version 1803 (OS Build 17134.320)
IIS 10 Version 10.0.17134.1

MDMower
  • 186
  • 6
  • Have you looked at the line endings of the xml file? They shouldn't matter, but that could be a difference in the software that creates them. – Stephen Ostermiller Oct 02 '18 at 15:27
  • Thanks but it is not line ending or file encoding related. You can copy the contents between the directory created in Windows Explorer and the directory created by bash on Windows and the results are the same. – MDMower Oct 02 '18 at 18:25

1 Answers1

2

Credit to therealkenc at github.com/Microsoft/WSL/issues/3596 for pointing me in the right direction. The issue is related to Per-directory case sensitivity and WSL.

Query a directory's case sensitive flag:

fsutil.exe file queryCaseSensitiveInfo <path>

Set a directory's case sensitive flag:

fsutil.exe file setCaseSensitiveInfo <path> enable
fsutil.exe file setCaseSensitiveInfo <path> disable

After disabling the case sensitive flag on the WebBash directory, IIS read Web.config just fine. This led me to consider the possibility that IIS was looking for lower-case web.config. I re-enabled case sensitivity on directory WebBash and copied Web.config to web.config (yep, Windows Explorer let me keep both in the same folder). IIS read web.config just fine!

Web.config and web.config in same case-sensitive Windows directory

MDMower
  • 186
  • 6