问题描述
我在 IIS 7.5 中安装了一个 ASP.NET 4.0 Web 表单应用程序.如果我将应用程序池设置为 DefaultAppPool (.NET Framework 2.0),我会在配置页面上显示 Providers、.NET-Roles 和 .NET-Users 的图标IIS 管理器中的应用程序,我可以管理 IIS 中的用户和角色.(我正在使用表单身份验证.)
I have installed an ASP.NET 4.0 Web forms application in IIS 7.5. If I set the application pool to DefaultAppPool (.NET Framework 2.0) I get the icons for Providers, .NET-Roles and .NET-Users displayed on the configuration page for the application in IIS Manager and I can manage users and roles within IIS. (I'm using Forms authentication.)
但是如果我将应用程序池设置为 ASP.NET v4.0 我会遇到问题:双击 IIS 管理器中的用户或角色的图标会抛出一个错误,告诉我我无法使用这些功能,因为无法将提供者确定为受信任.如果我在 trustedProviders 部分 allowUntrustedProviders="true" 的 administration.config 中设置并再次双击其中一个图标,我会收到错误消息无法找到程序集 System.Web, Version 4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.如果我重新启动 IIS 管理器,图标会完全消失.
But if I set the application pool to ASP.NET v4.0 I get a problem: Double clicking on the icons for Users or Roles in IIS Manager throws an error telling me that I cannot use these features since the providers could not be determined as trusted. If I set in administration.config in the trustedProviders section allowUntrustedProviders="true" and double click again on one of the icons I get the error that the assembly System.Web, Version 4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a could not be found. If I restart IIS Manager the icons disappear completely.
.NET Framework 4.0 肯定是安装的.所以这一切都很令人困惑.我知道 .NET 4 使用的 GAC 不同于 .NET 2-3 的旧 GAC.IIS 管理器是否有可能无法找到适用于 .NET 4 的新 GAC?我是否必须将一些新的 4.0 程序集添加到 administration.config 中?是否有其他方法可以代替 IIS 添加用户和角色?
.NET Framework 4.0 is definitely installed. So this is all quite confusing. I know that .NET 4 uses another GAC than the old one for .NET 2-3. Could it be possible that IIS Manager is not able to find the new GAC for .NET 4? Do I have to add perhaps some of the new 4.0 assemblies to administration.config? Is there another way to add users and roles instead of IIS?
提前感谢您的帮助!
推荐答案
不幸的是,如果您的应用程序池使用 .NET 4.0,则目前不支持这些功能,因为这需要 IIS 管理器加载 .NET 4.0 框架才能调用正确的提供者(这就是 .NET 用户/成员、.NET 角色等的原因),这是不可能的,因为 IIS 管理器是一个 .NET 2.0 应用程序.
Unfortunately, currently those features are not supported if your Application Pool is using .NET 4.0 since that would require IIS Manager to load the .NET 4.0 framework in order to call the right providers (and that is why .NET Users/Membership, .NET Roles, etc), and it is not possible since IIS Manager is a .NET 2.0 application.
所以目前没有好的解决方法,除了将您的应用程序池暂时更改为 2.0 并添加它们,然后切换回 4.0.但是当然你不应该这样做,除非它只是一个开发机器.
So for now there is no good workaround, other than changing your Application Pool temporarily to 2.0 and adding them and then switching back to 4.0. But of course you should not do this unless its just a development machine.
否则,您可以使用 CreateUserWizard 控件构建页面并使用 ASP.NET 中的内置登录控件,该控件应该是一行(标记)以获得类似的功能.
Otherwise you could build a page using the CreateUserWizard control and use the built-in Login controls from ASP.NET which should be a one line (of markup) to get similar functionality.
这篇关于如何在 IIS 管理器中为 ASP.NET 4.0 应用程序添加用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!