2

Long and short my machine had issues and I had to rebuild it. I reinstalled all my software and put my project backups back on the machine. I have been trying to solve SQL connect issues that I just can't get around.

So after going through many changes and error, I put the working production version back on my machine. When I run it I get the following error: Parser Error Message: Unknown database 'p10009307_sec'

The Database is known to my SQL Workbench and If I drop a Database connection on a page and configure it I can connect.

The Question is where is it looking that it can't find MySQL? I assume its in the Webconfig, but I don't see anything out of the ordinary that would make localhost diffrent. I made a copy of my webconfig with only the sections that refrence MySQL.

 `<connectionStrings>
<remove name="LocalMySqlServer" />
<add name="LocalMySqlServer" connectionString="server=localhost;password=xxxxxxxxxx;
User Id=xxxxxxxxxx;logging=True;database=xxxxxxxxxx_sec" providerName="MySql.Data.MySqlClient" />
<add name="'LocalSqlServer" connectionString="server=localhost;database=xxxxxxxxxx_CUS;
logging=True;password=xxxxxxxxxx;User Id=xxxxxxxxxxER" providerName="MySql.Data.MySqlClient" />

<remove name="LocalSqlServer" />
<add name="p10009307_cusConnectionString" connectionString="server=localhost;
User Id=xxxxxxxxxxER;password=xxxxxxxxxx;database=xxxxxxxxxx_CUS"
providerName="MySql.Data.MySqlClient" />
<add name="p10009307_cusConnectionString2" connectionString="server=localhost;
User Id=xxxxxxxxxER;password=xxxxxxxxxx;database=xxxxxxxxxx_CUS; 
SQL SERVER MODE=True" providerName="MySql.Data.MySqlClient" />

</connectionStrings>

<system.data>
   <DbProviderFactories>
     <add name="MySQL Data Provider" invariant="MySQL.Data.MySqlClient" 
     description=".Net Framework Data Provider for MySQL"
     type="MySQL.Data.MySqlClient.MySqlClientFactory, MySql.Data, 
     Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
  </DbProviderFactories>
</system.data>
<system.web>
    <customErrors mode="Off" />
    <compilation targetFramework="4.0" debug="true">
    <assemblies>
        <add assembly="MySql.Data, Version=6.4.4.0, Culture=neutral,
        PublicKeyToken=c5687fc88969c44d" />
    </assemblies>
    </compilation>
    <authorization>
        <allow roles="Admin" />
    </authorization>
    <authentication mode="Forms">
       <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
    </authentication>
    <membership defaultProvider="MySQLMembershipProvider">
      <providers>
          <clear />
              <remove name="MySQLMembershipProvider" />
              <add name="MySQLMembershipProvider"
              type="MySql.Web.Security.MySQLMembershipProvider, 
              MySql.Web, Version=6.4.4.0, Culture=neutral, 
              PublicKeyToken=c5687fc88969c44d" applicationName="/" 
              description="Membership Provider" 
              connectionStringName="LocalMySqlServer" 
              writeExceptionsToEventLog="True" 
              autogenerateschema="True" 
              enablePasswordRetrieval="False" 
              enablePasswordReset="True" 
              requiresQuestionAndAnswer="False" 
              requiresUniqueEmail="False" passwordFormat="Clear" 
              maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
              minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10"
              passwordStrengthRegularExpression="" />
      </providers>
    </membership>
<profile defaultProvider="MySQLProfileProvider">
  <providers>
    <clear />
    <remove name="MySQLProfileProvider" />
    <add name="MySQLProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider, 
    MySql.Web, Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
    applicationName="/" description="Profile provider" 
    connectionStringName="LocalMySqlServer" writeExceptionsToEventLog="False"
    autogenerateschema="True" />
 </providers>
</profile>
<roleManager enabled="true" defaultProvider="MySQLRoleProvider">
  <providers>
    <clear />
    <remove name="MySQLRoleProvider" />
    <add applicationName="/" description="Role Provider" connectionStringName="LocalMySqlServer"
    writeExceptionsToEventLog="True" autogenerateschema="True" name="MySQLRoleProvider"
    type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.4.4.0, Culture=neutral,
    PublicKeyToken=c5687fc88969c44d" />
 </providers>
</roleManager>
<sessionState mode="Custom" cookieless="true" regenerateExpiredSessionId="true"
customProvider="MySqlSessionStateProvider">
<providers>
    <add name="MySqlSessionStateProvider" type="MySql.Web.SessionState.MySqlSessionStateStore,
    MySql.Web, Version=6.4.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
    applicationName="/" description="State Provider" connectionStringName="LocalMySqlServer"
    writeExceptionsToEventLog="True" autogenerateschema="True" />
</providers>
</sessionState></system.web>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" />
    <bindingRedirect oldVersion="0.0.0.0-6.3.7.0" newVersion="6.4.4.0" />
  </dependentAssembly>
</assemblyBinding>
  </runtime>

</configuration>`

Everything is running local host at this point I have put the DLL's in the bin directory, I don't know what i am missing.

Community
  • 1
  • 1
StephanM
  • 733
  • 3
  • 22
  • 36

2 Answers2

2

I don't see anything in that config snippet that tells the "MySQL Data Provider" which one out of available conn-strings to use.

There's got to be something in the code that tells it either the conn-string name or the conn-string value. Something like this:

System.Configuration.ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString

Also, your 2nd conn-string has a single-quote character right before its name: 'LocalSqlServer

Perhaps you accidentally added it, and now the conn string cannot be found by the name of "LocalSqlServer" (if that's the one that's the problem, anyway).

  • Parser Error Message: Unknown database 'p10009307_sec' Line 81: Line 82: Line 85: – StephanM Jan 30 '12 at 16:37
  • I'm not sure I fully understand the "Unknown database 'p10009307_sec'" part, especially because it's labeled "parser error". Parser errors in the context of web.config would relate to either xml-syntax or conn-string syntax. Is your conn-string correct? If in doubt: create a .udl file (rename empty text file to something.udl); double-click it to open, then use it to set up and test the conn-string. After you're done, open that file in notepad, and conn-string will be there for you to copy it. Also, take a look at http://connectionstrings.com site; maybe you'll find some pointers there. –  Jan 30 '12 at 16:48
  • it doesn't seem to like the first 5 attributes of the add?customProvider="MySqlSessionStateProvider"> – StephanM Jan 30 '12 at 16:55
  • I deleted the database and tryed to recreate it. It is definitly having issues with the – StephanM Jan 30 '12 at 19:10
  • Well I think I have eliminated most of the errors except for one. Why "The 'connectionStringName' attribute is not allowed." i don't understand. If I remove it it says it can't be blank. – StephanM Feb 01 '12 at 14:39
  • Where did you get that mysql provider? Is there anything in their documentations? –  Feb 01 '12 at 14:41
  • In these cases, I would probably try to isolate the problem somehow. Maybe create another web project (temporarily), and add just this mysql session provider, and see if you have the same problems. Don't walk away from that temp site until you find the fix, then apply the fix to the real site. –  Feb 01 '12 at 16:07
  • I have tried that, So today I am going to uninstall MySQL and reinstall it. Maybe I answered some question wrong. – StephanM Feb 02 '12 at 14:39
  • uninstalled the MySql Server and reinstalled the most current one. I am beginning to think the problem lies with how the Web Site Administration Tool see's the database. I still get an error **There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store. The following message may help in diagnosing the problem: Unknown database ** – StephanM Feb 02 '12 at 18:05
0

If you want to use the MySQL database to store the session, you have to declare this in the Sessionstate of the web.config. Furthermore you have to look into the machine.config file if all the MySQL providers are set.

Cerveser
  • 752
  • 8
  • 23
  • 1
    I'm not sure what worked it's way in to my schema's, but dropping the tables didn't help and reinstalling the MySQL Server didn't help. Only after dropping the schema's would I see all the Errors go away and everything work as planned. – StephanM Feb 14 '12 at 15:56