简体   繁体   English

C# applicationHost.config 未找到但存在

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

I'm getting a strange error when accessing applicationsHost.config.访问applicationsHost.config 时出现一个奇怪的错误。 I've run VisualStudio in administrator mode and trying to access我已经在管理员模式下运行 VisualStudio 并尝试访问

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

but I get exception FileNotFound while file exists.但是文件存在时出现异常 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

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

It turned out it's related 'File System Redirection' on Windows 8.1 onward.原来它与 Windows 8.1 及以后的“文件系统重定向”有关。 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所以 %windir%\System32 将被重定向到 %windir%\SysWOW64 感谢@NGambit 我必须将配置类型更改为 x64 才能访问 applicationhost.config

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

相关问题 Applicationhost.config未更新 - Applicationhost.config not updated 以编程方式解锁applicationHost.config中的部分 - Unlock section in applicationHost.config programmatically applicationhost.config中的位置路径未映射到程序集 - Location path in applicationhost.config not mapping to assembly IIS CLI为我的项目生成带有site的applicationhost.config - IIS CLI generate applicationhost.config with site for my project Microsoft.Web.Administration-ApplicationHost.Config中带有httpError的NullReferenceException - Microsoft.Web.Administration - NullReferenceException with httpErrors in ApplicationHost.Config 由于applicationHost.config无效,.Net构建失败 - .Net build is failing due to invalid applicationHost.config 如何将IIS ApplicationHost.config文件解析为.Net对象? - How to parse the IIS ApplicationHost.config file into .Net objects? ASP.NET 核心 web.config requestFiltering 不覆盖 applicationhost.config - ASP.NET Core web.config requestFiltering not overriding applicationhost.config 初始化 applicationhost.config 文件失败。 找不到 IIS Express - Initializing the applicationhost.config file failed. Cannot find IIS Express applicationHost.config 错误:由于 IIS 共享配置的权限不足,无法写入配置文件 - applicationHost.config Error: Cannot write configuration file due to insufficient permissions with IIS shared configuration
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM