麻烦实施角色提供者

时间:2013-03-10 19:09:55

标签: xml asp.net-mvc connection-string

它告诉我连接字符串不正确,并且不支持“metadata”关键字。

连接字符串:生成模型时自动创建

<connectionStrings>
    <add name="DataContext"  connectionString="metadata=res://*/Models.Model.csdl|res://*/Models.Model.ssdl|res://*/Models.Model.msl;
      provider=System.Data.SqlClient;
      provider connection string='data source=.\SQLEXPRESS;
      initial catalog=&quot;Phase 2&quot;;
      integrated security=True;
      multipleactiveresultsets=True;
      application name=EntityFramework'" 
      providerName="System.Data.EntityClient" />
</connectionStrings>

角色管理器:将connectionStringName设置为上面连接字符串的名称

<roleManager enabled="true">
  <providers>
    <clear />
    <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="DataContext" applicationName="/" />
  </providers>
</roleManager>

当我调用方法 Roles.CreateRole 时,它会给我以下错误

An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection     object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax.

内部异常

{"Keyword not supported: 'metadata'."}

有什么想法吗?

0 个答案:

没有答案