IIS 7.5 applicationHost.config file is not being updated

有些话、适合烂在心里 提交于 2019-11-30 01:31:45

I just tried your code and it works fine. You are aware that this mime type is being added to the global mime type collection and not to a site?

It also gets added to the end of the <staticContent> list, this list isn't re-sorted when you do ServerManager.CommitChanges().

Also on Windows 2008-R2 the correct location for applicationHost.config is at:

C:\Windows\System32\inetsrv\config

I'm guess you're either using notepad.exe or NotePad2 to open this file (32 bit editors can't open it). Notepad won't reload the file upon a change and NotePad2 needs to be told to display a file change notification (alt-F5), out of the box it won't.

Also try adding something unusual like .xxx, run your update then open the config file and do a search. I guarantee it'll be there.

Update:

Further to your comments below, I'm not sure how you're able to open applicationHost.config using NotePad++ or any 32-bit editor, I certainly can't. Can you download NotePad2 which is a 64-bit editor:

http://www.flos-freeware.ch/notepad2.html

The release candidate works just fine.

On a default install of any 64 bit Windows 2008 or Windows 7 there shouldn't be an applicationHost.config in the C:\Windows\SysWOW64\inetsrv\Config folder. I'm not sure why you'd be seeing one there.

user717236

As a workaround to open and edit the 64-bit IIS configuration files with your favorite 32-bit editor that is 64-bit compatible (i.e. Notepad++), you can create a Windows directory symbolic link which points to C:\Windows\System32\inetsrv\Config. With this method, you are replacing the 32-bit Config directory, located at C:\Windows\SysWOW64\inetsrv\Config to point to the 64-bit version. If, for example, you have an application which requires both 32-bit and 64-bit versions, this method won't work.

For more information, I strongly encourage you to visit this MSDN Blog.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!