为什么在尝试设置 IIS 应用程序池的凭据时收到"Value does not fall within the expected range"错误?



我有一个以前创建的名为"测试"的应用程序池。我在此处遵循本文中的说明,让池在帐户下运行:

https://learn.microsoft.com/en-us/iis/manage/powershell/powershell/powershell-snap-in-making-making-simple-configuration-changes-changes-to-web-sites-web-sites-and-application-pools

这是我的代码:

$pool = Get-Item IIS:AppPoolstest
$pool.ProcessModel.UserName = [string]'domaintestname'
$pool.ProcessModel.Password = [string]'testpassword'
$pool.processModel.identityType = 3
$pool | Set-Item

但是,这给了我一个错误:

Set-Item : Value does not fall within the expected range.
At line:5 char:9
+ $pool | Set-Item
+         ~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-Item], ArgumentException
    + FullyQualifiedErrorId : path,Microsoft.PowerShell.Commands.SetItemCommand

我做错了什么吗?我缺少什么价值?

我发现了这个问题。看来,在我的项目中清理未使用的Nuget软件包时,我不小心删除了Ninject,这对于依赖注入工作至关重要。我重新安装了与ASP.NET相关的几个NINEXT组件,并且能够再次运行它。

遇到此问题时,通过项目进行检查可能很有用,并检查依赖项注射是否已实施甚至部分实施。

相关内容

最新更新