ASPNET RoleProvider 错误
我刚刚在 win2003 服务器上安装了一个应用程序,但收到此错误:
Line 149: <roleManager>
Line 150: <providers>
Line 151: <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Line 152: <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Line 153: </providers>
Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config Line: 151
我正在使用 RoleProvider 并且它在 web.config 中正确配置(它适用于其他服务器),如下所示:
<membership defaultProvider="AdminMembershipProvider">
<providers>
<clear/>
<add name="AdminMembershipProvider" connectionStringName="SiteSqlServer" type="MyApp.Providers.AdminMembershipProvider" applicationName="MyApp" writeExceptionsToEventLog="false" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" PasswordFormat="Clear" MinRequiredNonAlphanumericCharacters="1" MinRequiredPasswordLength="8" MaxInvalidPasswordAttempts="5" PasswordAttemptWindow="10">
</add>
</providers>
</membership>
<roleManager enabled="true" defaultProvider="AdminRoleProvider" cacheRolesInCookie="true">
<providers>
<add name="AdminRoleProvider" type="MyApp.Providers.AdminRoleProvider" writeExceptionsToEventLog="true"/>
</providers>
</roleManager>
关于为什么它在上查找配置的任何提示machine.config 而不是 web.config? 我该如何调试这个?
谢谢。
I just installed an application on a win2003 server and I'm getting this error:
Line 149: <roleManager>
Line 150: <providers>
Line 151: <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Line 152: <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Line 153: </providers>
Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config Line: 151
I'm using a RoleProvider and it's properly configured in web.config (it works on other servers) as follows:
<membership defaultProvider="AdminMembershipProvider">
<providers>
<clear/>
<add name="AdminMembershipProvider" connectionStringName="SiteSqlServer" type="MyApp.Providers.AdminMembershipProvider" applicationName="MyApp" writeExceptionsToEventLog="false" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" PasswordFormat="Clear" MinRequiredNonAlphanumericCharacters="1" MinRequiredPasswordLength="8" MaxInvalidPasswordAttempts="5" PasswordAttemptWindow="10">
</add>
</providers>
</membership>
<roleManager enabled="true" defaultProvider="AdminRoleProvider" cacheRolesInCookie="true">
<providers>
<add name="AdminRoleProvider" type="MyApp.Providers.AdminRoleProvider" writeExceptionsToEventLog="true"/>
</providers>
</roleManager>
Any hint on why it's looking for configuration on machine.config instead of web.config? How can I debug this?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实上,它首先读取 machine.config,然后读取取代 machine.config 的 web.config。 但在某些情况下,web.config 中的值会附加或包含在列表中,因此可能会有点难以理解。
但是仔细阅读工作服务器上的 machine.config 可能会给您带来更多启发。
Indeed it read machine.config first, then your web.config which supercedes machine.config. But in some cases the values in the web.config are appended or included in a list so it can get a little hard to follow.
But perusing the machine.config on a working server might shed some more light for you.
Machine.Config 保存与整个计算机相关的设置。 Machine.Config 的某些元素允许您覆盖它们。 如果某个元素具有
allowOverride = "true"
属性,则可以覆盖 web.config。 但是,如果它在其他机器上工作,我会查看 machine.config 文件中的差异。请记住,编辑 machine.config 通常不是一个好主意。 如果您计划部署到多台计算机。
The Machine.Config holds settings that pertain to the entire computer. Some Elements of the Machine.Config allow you to override them. If an element has a
allowOverride = "true"
attribute it can be overridden the web.config. However, if it works on other machines I would look at differences in machine.config files.Keep in mind it is not usually a good idea to edit the machine.config esp. if you plan on deploying to multiple machines.