How to enable case-sensitivity under IIS Express?

后端 未结 2 1684
耶瑟儿~
耶瑟儿~ 2020-12-18 01:13

How should I go about enabling case sensitive request handling if using IIS Express? Is there a setting in IIS Express? or can a URL Rewrite rule accomplish this? or perhaps

2条回答
  •  时光说笑
    2020-12-18 01:41

    As already pointed out by Kevin Rice, this has nothing to do with IIS.
    This is all about the file system, the file-system driver and the operating system / asp.net.

    The default file-system for Windows 2000+ is NTFS, which is case-insensitive. What you need is a case-sensitive file system, so you should look for a file system driver for windows that is case-sensitive.

    The usual default Linux file-systems (called ext2/ext3/ext4) are all case-sensitive. And you can find a windows driver for them here: http://www.ext2fsd.com/

    All you need to do is to put your application on that file-system, and configure IIS to start the application from there (you might want to dual-boot install Linux so you actually do have a ext4 partition on that computer - be careful, if you do that wrong, your data may be GONE).

    What would bother me more is why the S3 file system is case-sensitive.
    That is a very bad thing, if somebody mistypes your URL, or if a search-engine lowercases it, you get a 404...

    May I suggest that instead of looking how you can get windows to be case-sensitive, you look how you can get S3 to become case-insensitive, that's probably the better approach.

    I don't actually know how to do that on S3 since I don't know S3.
    What I do know however is Linux (which Amazon S3 is probably using), so if you can make your own file system, at the bottom of my post here you find (commented out) ways of doing this.

    In a nutshell, you create a .dsk file of wanted size X bytes (X = count * blocksize) format it with a case-insensitive file-system (vfat, jsf, hfsplus) and loopmount it to /mnt/whatever.

    Then you put your web application in /mnt/whatever, and configure the root directory for the web-application to be there.

    Note that if you omit -O in JFS, it will be case-sensitive.

    apt-get install jfsutils
    dd if=/dev/zero of=jfs.dsk bs=1048576 count=150
    mkfs.jfs -O jfs.dsk
    mkdir -p /mnt/jfs
    mount /volumes/jfs.dsk /mnt/jfs -t jfs -o loop
    umount /mnt/jfs/
    

    or like this with hfs-plus (best performance, HFS: high-performance file-system)

    sudo apt-get install hfsprogs
    sudo modprobe hfsplus
    sudo dd if=/dev/zero of=hfsplus.dsk bs=1048576 count=150
    sudo mkfs.hfsplus /volumes/hfsplus.dsk
    sudo mount /volumes/hfsplus.dsk /mnt/hfsplus -t hfsplus -o loop
    umount /mnt/hfsplus/
    

    Also, if you don't want to (or can't) install anything, vfat is usually installed by default:

    mkfs -T vfat /volumes/vfat.dsk
    

    Also, Red-Hat derived Distributions of Linux (like S3) don't use apt-get, they use rpm/yum.

    And, if you want the filesystem to be permanently mounted, you need to add the entry to /etc/fstab more on it here: https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Introduction_To_System_Administration/s2-storage-mount-fstab.html

    or you can add a startup script that mounts this particular file system on every system restart/boot.

提交回复
热议问题