简体   繁体   中英

C# applicationHost.config not found but exists

I'm getting a strange error when accessing applicationsHost.config. I've run VisualStudio in administrator mode and trying to access

C:\Windows\System32\inetsrv\config\applicationHost.config

but I get exception FileNotFound while file exists.

var file = @"C:\Windows\System32\inetsrv\config\applicationHost.config";
var fileExist = System.IO.File.Exists(file); //it always returns false
var fi=System.IO.File.OpenRead(file);  //Throws FileNotFound exception

I've tested on VS2013 and VS2017 on Windows 10. I don't get any error related to permission and even I've added Everyone to the folder to be sure it's related to that.

It turned out it's related 'File System Redirection' on Windows 8.1 onward. So %windir%\System32 would be redirected to %windir%\SysWOW64 Thanks to @NGambit I had to change config type to x64 to be able to access applicationhost.config

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM