2
votes

I am receiving an error when trying to launch my application and I believe there is an error in my web.config file (see below). I have combined my MembershipProvider schema with my existing RESTAURANT DB.

I have 2 connection strings, one is LINQ to Entities which I use to populate my restaurant data for my application and the other is a SQL Server 2008 R2 connection for use with the membership and role provider.

The error I am receiving is on the line that begins: role manager="true"

Here is my Web.Config

<configuration>
    <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>
    <appSettings></appSettings>
    <connectionStrings>
        <add name="RestaurantDB" 
             connectionString="data source=SFP\SFP_SQL_SVR;attachdbfilename=C:\Users\Susan\Documents\Databases\Restaurants.mdf;Initial Catalog=Restaurants.mdf;Integrated Security=SSPI;"/>
        <add name="RestaurantsEntities" 
             connectionString="metadata=res://*/Restaurant.csdl|res://*/Restaurant.ssdl|res://*/Restaurant.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SFP\SFP_SQL_SVR;attachdbfilename=C:\Users\Susan\Documents\Databases\Restaurants.mdf;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" 
             providerName="System.Data.EntityClient" />
    </connectionStrings>
    <roleManager enabled="true"
                 defaultProvider="CustomizedRoleProvider">
       <providers>
          <add name="CustomizedRoleProvider"
               type="System.Web.Security.SqlRoleProvider"
               connectionStringName="RestaurantsDB" />
       </providers>
    </roleManager>
    <membership defaultProvider="CustomizedMembershipProvider">
       <providers>
          <add name="CustomizedMembershipProvider"
               type="System.Web.Security.SqlMembershipProvider"
               connectionStringName="RestaurantsDB" />
       </providers>
    </membership>
</configuration>
2
Could not find schema for the element 'role manager'Susan
Mystery Man ... where is he missing 's'????Susan

2 Answers

3
votes

<roleManager> and <membership> are children of <system.web>

Try this:

<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
  <appSettings>

  </appSettings>

  <connectionStrings>
    <add name="RestaurantDB" connectionString="data source=SFP\SFP_SQL_SVR;attachdbfilename=C:\Users\Susan\Documents\Databases\Restaurants.mdf;Initial Catalog=Restaurants.mdf;Integrated Security=SSPI;"/>
    <add name="RestaurantsEntities" connectionString="metadata=res://*/Restaurant.csdl|res://*/Restaurant.ssdl|res://*/Restaurant.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SFP\SFP_SQL_SVR;attachdbfilename=C:\Users\Susan\Documents\Databases\Restaurants.mdf;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>

  <system.web>
      <compilation debug="true" targetFramework="4.0" />

      <roleManager enabled="true"
           defaultProvider="CustomizedRoleProvider">
          <providers>
              <add name="CustomizedRoleProvider"
                  type="System.Web.Security.SqlRoleProvider"
                  connectionStringName="RestaurantsDB" />
          </providers>
      </roleManager>

      <membership defaultProvider="CustomizedMembershipProvider">
           <providers>
               <add name="CustomizedMembershipProvider"
                   type="System.Web.Security.SqlMembershipProvider"
                   connectionStringName="RestaurantsDB" />
           </providers>
      </membership>
  </system.web>
</configuration>

See: http://msdn.microsoft.com/en-us/library/ms228147.aspx

See: http://msdn.microsoft.com/en-us/library/dayb112d.aspx

3
votes

You are specifying

<add name="RestaurantDB"

wrong

     connectionStringName="RestaurantsDB" />

correct

     connectionStringName="RestaurantDB" />  

if this solves then pray for me