2013-03-01 56 views
0

我下載了nearforum並將其設置爲與我的MySql最好的能力。我得到這個錯誤:asp.net MVC MySQL錯誤[無法初始化提供程序。缺少或不正確的模式。]

Server Error in '/' Application. 
    -------------------------------------------------------------------------------- 

    Configuration Error 
    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: Unable to initialize provider. Missing or incorrect schema. 

    Source Error: 


    Line 49:    <clear/> 
    Line 50:    <add name="ForumsMembershipProvider" 
    Line 51:      type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.6.4.0, Culture=neutral" 
    Line 52:      connectionStringName="Forums" 

    Source File: C:\nearforumsc#\web\web.config Line: 51 

//This is my config file. 

    <?xml version="1.0" encoding="utf-8"?> 
    <!-- 
     For more information on how to configure your ASP.NET application, please visit 
     http://go.microsoft.com/fwlink/?LinkId=152368 
     --> 
    <configuration> 
     <configSections> 
      <section name="routeMapping" type="NearForums.Configuration.Routing.RouteMappingConfiguration, NearForums" requirePermission="false" /> 
      <section name="site" type="NearForums.Configuration.SiteConfiguration, NearForums" requirePermission="false" /> 
      <section name="redirector" type="NearForums.Configuration.Redirector.RedirectorConfiguration, NearForums" requirePermission="false" /> 
      <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" requirePermission="false" /> 
     </configSections> 
     <appSettings> 
      <add key="ClientValidationEnabled" value="true" /> 
      <add key="UnobtrusiveJavaScriptEnabled" value="true" /> 
     </appSettings> 
     <routeMapping configSource="Config\Routes.config" /> 
     <site configSource="Config\Site.config" /> 
     <redirector configSource="Config\Redirector.config" /> 
     <nlog configSource="Config\Logging.config" /> 
     <connectionStrings> 
      <add name="Forums" connectionString="Server=localhost;Database=nearforum;UID=root;PASSWORD=admin;" providerName="MySql.Data.MySqlClient" /> 
    <!-- 
      The above connectionstring with name "forums" will be used by the site. 
      Below this line you can see 2 samples of connection strings, one that points to a Microsoft SQL Server database and other that points to a MySql database. 
      <add name="ForumsMSSQL" connectionString="Data Source=localhost;Initial Catalog=Forums;User ID=root;Password=admin" providerName="System.Data.SqlClient"/> 
      <add name="ForumsMySql" connectionString="Server=localhost;Database=nearforum;UID=root;PASSWORD=admin;" providerName="MySql.Data.MySqlClient"/> 
    --> 
     </connectionStrings> 
     <system.data> 
      <DbProviderFactories> 
       <remove invariant="MySql.Data.MySQLClient" /> 
       <add invariant="MySql.Data.MySqlClient" name="MySQL Data Provider" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" /> 
      </DbProviderFactories> 
     </system.data> 
    <!-- 
     <system.net> 
      <mailSettings> 
       <smtp deliveryMethod="SpecifiedPickupDirectory" from="[email protected]"> 
        <specifiedPickupDirectory pickupDirectoryLocation="c:\Temp\"/> 
       </smtp> 
      </mailSettings> 
     </system.net> 
    --> 
     <system.web> 
      <authentication mode="Forms" /> 
      <membership defaultProvider="ForumsMembershipProvider"> 
       <providers> 
        <clear/> 
        <add name="ForumsMembershipProvider" 
         type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.6.4.0, Culture=neutral" 
         connectionStringName="Forums" 
         enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="30" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="NearForums"/> 

       </providers> 
      </membership> 
      <compilation targetFramework="4.0"> 
       <assemblies> 
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
        <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
        <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
       </assemblies> 
      </compilation> 
      <customErrors mode="RemoteOnly"/> 
      <pages> 
       <namespaces> 
        <add namespace="System.Web.Helpers" /> 
        <add namespace="System.Web.Mvc" /> 
        <add namespace="System.Web.Mvc.Ajax" /> 
        <add namespace="System.Web.Mvc.Html" /> 
        <add namespace="System.Web.Routing" /> 
        <add namespace="System.Web.WebPages" /> 
       </namespaces> 
      </pages> 
      <httpHandlers> 
       <remove verb="GET,HEAD,POST" path="*" /> 
       <add verb="*" path="*" type="NearForums.Web.Handlers.StaticFileHandler, NearForums.Web" /> 
      </httpHandlers> 
      <httpModules> 
       <add name="RedirectorModule" type="NearForums.Web.Modules.RedirectorModule, NearForums.Web" /> 
       <add name="ModelBinderModule" type="NearForums.Web.Modules.ModelBinderModule, NearForums.Web" /> 
       <add name="CompressionModule" type="NearForums.Web.Modules.CompressionModule, NearForums.Web" /> 
      </httpModules> 
      <httpRuntime requestValidationMode="2.0" /> 
     </system.web> 
    <!-- 
     IIS 7.0. or above 
    --> 
     <system.webServer> 
      <validation validateIntegratedModeConfiguration="false" /> 
      <modules runAllManagedModulesForAllRequests="true"> 
       <add name="RedirectorModule" type="NearForums.Web.Modules.RedirectorModule, NearForums.Web" /> 
       <add name="ModelBinderModule" type="NearForums.Web.Modules.ModelBinderModule, NearForums.Web" /> 
      </modules> 
     </system.webServer> 
     <runtime> 
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
       <dependentAssembly> 
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> 
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /> 
       </dependentAssembly> 
      </assemblyBinding> 
     </runtime> 
    </configuration> 

回答

0

不得不手動添加行:TY網站開發,爲這是浪費時間的簡單。

<roleManager enabled="true" defaultProvider="MySqlRoleProvider"> 
<providers> 
<clear /> 
<add connectionStringName="MySqlMembershipConnection" 
applicationName="/" 
name="MySqlRoleProvider" 
type="MySql.Web.Security.MySQLRoleProvider, mysql.web" 
autogenerateschema="true"/> 
</providers> 
</roleManager> 

<profile> 
<providers> 
<clear/> 
<add type="MySql.Web.Security.MySqlProfileProvider, mysql.web" 
name="MySqlProfileProvider" 
applicationName="/" 
connectionStringName="MySqlMembershipConnection" 
autogenerateschema="true"/> 
</providers> 
</profile> 
相關問題