user4612290
user4612290

Reputation: 321

MySql Connector/Net conflicting with application running SQL Server

I have an ASP.Net web application that runs on my local machine uses a datasource from a remote SQL Server 2012.

I installed MySQL server on my machine for a completely different project and now when I do any process on my application that uses the remote database, I receive the following error:

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: Host '(ahostnumber)' is not allowed to connect to this MySQL server

Source Error: 

Line 283:    <siteMap>
Line 284:      <providers>
Line 285:        <add name="MySqlSiteMapProvider" type="MySql.Web.SiteMap.MySqlSiteMapProvider, MySql.Web, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="LocalMySqlServer" applicationName="/" />
Line 286:      </providers>
Line 287:    </siteMap>

Notice that if I removed Connector/NET everything would work fine.

Upvotes: 1

Views: 774

Answers (1)

Jeffrey St. Germain
Jeffrey St. Germain

Reputation: 33

Okay so I also ran into this problem and got my site back working. I feel this is a bit of a HACK and also feel there is a better solution since I do not want to have to update all my web.config files for all my projects. But hey at least I can do work till I find a better solution.

Because the machine.config is parent to web.config and we can override the machine.config in web.config. I changed my web.config in the section to look like this.

<siteMap>
  <providers>
    <!-- ADDED CLEAR TO REMOVE ANY CONFIGS FROM MACHINE.CONFIG -->
    <clear />
    <!-- ADDED TO REPLACE ONE NEEDED FOR MY APP -->
    <add name="AspNetXmlSiteMapProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="~/web.sitemap" securityTrimmingEnabled="true"/>
    <add name="DefaultProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="~/web.sitemap" securityTrimmingEnabled="false"/>
    <!-- THE REST OF YOUR SITEMAP PROVIDERS HERE... -->
  </providers>
</siteMap>

Hope this helps.

Upvotes: 2

Related Questions