繁体   English   中英

C# applicationHost.config 未找到但存在

[英]C# applicationHost.config not found but exists

访问applicationsHost.config 时出现一个奇怪的错误。 我已经在管理员模式下运行 VisualStudio 并尝试访问

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

但是文件存在时出现异常 FileNotFound 。

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

我已经在 Windows 10 上测试了 VS2013 和 VS2017。我没有收到任何与权限相关的错误,甚至我已经将所有人添加到文件夹中以确保它与此相关。

原来它与 Windows 8.1 及以后的“文件系统重定向”有关。 所以 %windir%\System32 将被重定向到 %windir%\SysWOW64 感谢@NGambit 我必须将配置类型更改为 x64 才能访问 applicationhost.config

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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