IIS reports "404 Not Found" error for folders created in WSL Bash
After the most recent update Win10 update (1803) IIS started reporting error "404 Not Found" for folders created in WSL Bash (Windows Subsystem for Linux).
Folder security settings (in Windows Explorer) look fine. I've even tried doing a "Replace all child object permissions" on the folder, but it didn't help.
The folder is stored on the Windows partition and is accessed in WLS as /mnt/c/inetpub/wwwroot/
.
IIS App pool is running under AppPoolIdentity
(changing it to my user didn't help).
Does anyone know what's going on? How can this be fixed?
P.S. I'm using a bash script to build my website.
Edit
After turning on the "Directory browsing" I've discovered that IIS does list the files contained within the directory. This means that it can access it. However for some reason it can't serve them (the files).
Solution 1:
This problem was caused by a changed introduced in Win build 17110, which made all new directories created in Bash to be case-sensitive (NTFS case-sensitive flag is set to enabled
).
If the flag is set for a directory can be checked via CMD:
fsutil file queryCaseSensitiveInfo C:\interpub\wwwroot\xyz
For some reason IIS 10.0 has problems accessing a directory if this flag set to enabled
.
The problem can be fixed by configuring WSL not to set this flag to enabled
by default. This can be done by editing the /etc/wsl.conf
and adding case=false
to the options list:
[automount]
options="case=off"
Solution 2:
This problem was caused by a changed introduced in Win build 17110, which made all new directories created in Bash to be case-sensitive (NTFS case-sensitive flag is set to enabled). — knee-cola
Make shure, that case sensitivity is disabled:
In cmd.exe or PowerShell:
fsutil.exe file queryCaseSensitiveInfo .
fsutil.exe file setCaseSensitiveInfo . disable
In bash.exe:
cd /
sudo umount /mnt/c
sudo mount -t drvfs C: /mnt/c -o rw,noatime,uid=1000,gid=1000,umask=22,fmask=11,metadata,case=off
Note: Not need to link directories like this:
ln -s SomeDir somedir
/ets/wsl.conf:
[automount]
enabled = true
options = "case=off,metadata,umask=22,fmask=11"
mountFsTab = false
Links:
- https://blogs.msdn.microsoft.com/commandline/2018/02/28/per-directory-case-sensitivity-and-wsl/
- https://blogs.msdn.microsoft.com/commandline/2018/06/14/improved-per-directory-case-sensitivity-support-in-wsl/
- https://blogs.msdn.microsoft.com/wsl