I have the following connection string in a web.config file to connect to MS Sql database.
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Server=developer\SqlExpress;Integrated Security=True;Database=mydb" providerName="System.Data.SqlClient"/>
I have MS SQL server and MySQL server on the same machine. When I try to run the application I get the following error in the line 285 in the machine.config file.
Error:
Parser Error Message: Authentication to host '' for user '' using method 'mysql_native_password' failed with message: Access denied for user ''@'localhost' (using password: NO)
<add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
The error is related to mySQL but I am trying to connect MS SQL.
How can I solve the problem?
This problem occurs when you install Mysql with MySql Connector Net. When Mysql Connector Net installed your computer, it configures your "machine.config" according to your .net version.
There are couple of ways to solve it.
1) You can add <clear />
tag in your provider. "Machine.config" overrides your custom provider, so to disable this we add <clear />
tag in your project web.config.
<siteMap defaultProvider="SitefinitySiteMap">
<providers>
<!-- This line added. -->
<clear />
<add name="SitefinitySiteMap" type="Telerik.Sitefinity.Web.SitefinitySiteMap, Telerik.Sitefinity" />
</providers>
</siteMap>
2) Second way is little bit tricky and if you use Mysql with .net, this might cause error on your projects.
Firstly, you need to find location of "machine.config". You can get more information here: https://stackoverflow.com/a/2325492/3801977
In my case, location is:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config
Open your "machine.config", and find following line and remove it:
<siteMap>
<providers>
<add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=8.0.13.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
</providers>
</siteMap>
"Remove" the MySqlSiteMapProvider provider in your web.config like this:
<siteMap>
<providers>
<remove name="MySqlSiteMapProvider" /> <!-- add this line -->
</providers>
</siteMap>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With