Microsoft.Web.Administration.ServerManager在IISExpress applicationHost.config中查找错误的目录 [英] Microsoft.Web.Administration.ServerManager looking in wrong directory for IISExpress applicationHost.config

查看:220
本文介绍了Microsoft.Web.Administration.ServerManager在IISExpress applicationHost.config中查找错误的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在当前计算机上获取应用程序池时,我遇到了一个奇怪的问题。似乎在安装IISExpress时,除了完整的IIS之外,Microsoft代码还要检查IISExpress。 IISExpress为每个用户使用单独的applicationHost文件。我不确定这个电话是否会要求它检查所有这些,或者只是当前用户的那些。无论如何,它找不到它在'C:\ Windows \system32 \ config \systemprofile \'目录中寻找的那个。对于正在执行此代码的应用程序池的用户来说,应该转到%userprofile%或'C:\ Users \ Administrators \'。

I have a strange problem when trying to get the application pools on the current machine. It seems that when IISExpress is installed, the Microsoft code wants to check IISExpress in addition to the full IIS. IISExpress uses separate applicationHost files per user. I'm not sure whether this call will require it to check all of those, or just those for the current user. Regardless, it's not finding the one it's looking for in the 'C:\Windows\system32\config\systemprofile\' directory. It should be going to %userprofile% or 'C:\Users\Administrator\' for the user that the application pool that this code is executing under is running as.

有没有人知道这个systemprofile目录可能来自哪里?

Does anyone perhaps know how this systemprofile directory might be coming from?

Exception:-
System.IO.DirectoryNotFoundException: Filename: \\?\C:\Windows\system32\config\systemprofile\Documents\IISExpress\config\applicationHost.config
Error: Cannot read configuration file


   at Microsoft.Web.Administration.Interop.AppHostWritableAdminManager.GetAdminSection(String bstrSectionName, String bstrSectionPath)
   at Microsoft.Web.Administration.Configuration.GetSectionInternal(ConfigurationSection section, String sectionPath, String locationPath)
   at Microsoft.Web.Administration.ServerManager.get_ApplicationPoolsSection()
   at Microsoft.Web.Administration.ServerManager.get_ApplicationPools()
   at CustomCode.Classes.IIsApplicationPool.GetApplicationPool(String iisWebSitePath, String poolName)


推荐答案

我强烈建议您停止使用IIS附带的Microsoft.Web.Administration本地引用(即使它在GAC中)。这是因为它有一个非常具体的版本号(即7.0.0.0),这个版本可能会在未来的Windows版本中发生变化,这会受到影响。

I highly recommend to stop using the local reference to Microsoft.Web.Administration that gets shipped with IIS (even if it's in the GAC). This is because it has a very specific version number (i.e. 7.0.0.0) and this version might change in a future version of Windows and it will hurt.

相反,结帐nuget包: Microsoft.Web.Administration https:/ /www.nuget.org/packages/Microsoft.Web.Administration )。这基本上使得您可以私有部署IIS依赖项。

Instead, checkout the nuget package: Microsoft.Web.Administration (https://www.nuget.org/packages/Microsoft.Web.Administration). This basically makes it so you can have a private deployment of your IIS dependencies.

这篇关于Microsoft.Web.Administration.ServerManager在IISExpress applicationHost.config中查找错误的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆