1

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 connect to any of the specified MySQL hosts.

Source Error:

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

Source File: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config Line: 285

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0


This is my C# code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class Booking_Location : System.Web.UI.Page
{

SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=Murahtour;Integrated Security=True");

protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnSearch_Click(object sender, EventArgs e)
{

    string state = ddlState.SelectedValue;
    string str = "SELECT LocTitle FROM Location WHERE LocTitle LIKE '%' + @state + '%'";
    SqlCommand cmd = new SqlCommand(str, conn);
    cmd.Parameters.Add("@state", SqlDbType.NVarChar).Value = state;

    conn.Open();

    cmd.ExecuteNonQuery();
    SqlDataAdapter da = new SqlDataAdapter();
    da.SelectCommand = cmd;
    DataSet ds = new DataSet();
    da.Fill(ds,"Location");
    GridView1.DataSource = ds;
    GridView1.DataBind();

    conn.Close();

    }
}

And I've tried to solve this problem by adding

<siteMap>     
    <providers>     
        <remove name="MySqlSiteMapProvider"/>
    </providers>
</siteMap>

in the Web.config but it shows invalid configuration... I also tried to follow the step in changing installation file for MySQL Connector in this forum

https://social.technet.microsoft.com/Forums/office/en-US/67527518-3567-46ca-94a4-70ed2a6362cb/error-unable-to-connect-to-any-of-the-specified-mysql-hosts?forum=sharepointgeneral

but I do not find any box to be unchecked. Now what should I do... I'm using Microsoft Visual Studio Ultimate 2010 for making an C# ASP.NET website. And I'm using MySQL Connector/C 6.1.

Nasrul Arif
  • 165
  • 1
  • 12

2 Answers2

0

I read on the Internet in another forum that if you have MySQL connector installed, that you should not have Web Providers installed. The answer used in the other forum is actually quoting StackOverflow, so it could be traced back to this older post in StackOverflow:

ASP.Net MVC4 configuration error after installing MySQL Connector .NET

I believe it is related to your issue if not the same, so I hope it helps.

Cheers

Community
  • 1
  • 1
0

[SOLVED]

I did not realized there is more than one MySQL Connector that uses same name in the control panel > program. When I clicked on MySQL Connector Net 6.9.9 and press change in the Control Panel > Program, there will be option to make Web Provider completely unavailable. After making that change, my Website can now run normally.

Nasrul Arif
  • 165
  • 1
  • 12
  • My MySQL Connector Net is version 6.9.9, the version may varies but this is the installation file that needed to be changed in the Control Panel. – Nasrul Arif Dec 04 '16 at 04:15