我跟随this site上的教程。
尝试实现Custom RoleProvider时,我收到以下错误。
Server Error in '/' Application
Description: An error occurred during the processing of a configuration file required to service this
request. Please review the specific error details below and modify
your configuration file appropriately.
Parser Error Message: This
method cannot be called during the application's pre-start
initialization phase
来源错误:
<providers>
<clear/>
<add name="MyroleProvider"type="MvcApplication1.Infrastructure.MyroleProvider"con ectionStringName="DatabaseContext" applicationName="/" />
</providers>
我已将web.config部分更新为以下内容,但我仍然收到错误。
<roleManager enabled="true" cacheRolesInCookie="true" defaultProvider="MyroleProvider">
<providers>
<clear/>
<add name="MyroleProvider" type="MvcApplication1.Infrastructure.MyroleProvider" connectionStringName="DatabaseContext" applicationName="/" />
</providers>
</roleManager>
答案 0 :(得分:0)
<providers>
<clear/>
<add name="MyroleProvider" type="MvcApplication1.Infrastructure.MyroleProvider" connectionStringName="DatabaseContext" applicationName="/" />
. . .
</providers>
这不是更像您要键入的XML吗?
并不具有同等性<providers>
<clear/>
<add name="MyroleProvider"type="MvcApplication1.Infrastructure.MyroleProvider"con ectionStringName="DatabaseContext" applicationName="/" />
单词连接已分段。
答案 1 :(得分:0)
我的问题解决了。 我定义了空项目并尝试实现Custom RoleProvider。 错误已解决。