Why is my MySQL connection string to a shared hosting site not working?

I'm using Microsoft Web Developer 2012 and I'm trying to connect to MySql Server on a shared hosting site. My connection string looks like this:

  <connectionStrings>
    <add name="ApplicationServices" Server="myserverAddress";Port="3306";Database="myDatabaseName";uid="myUserName";Pwd="myPassword"             
  </connectionStrings>

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

I've tried with and without the quotes and the port number. What could I be doing wrong here? I would really appreciate any help with this.

3 answers

First of all, there should not be any quotation marks around your connection string values there.

My first bet would be to double check what port number to use, as you're in a shared hosting environment where port numbers often are individual.

You can probably check this in your control panel or support pages of the hosting provider.

I didn't see the full code example at first;

Now I know the error is because of that the config entry is malformed.

It should look something like this instead.

<connectionStrings>
    <add name="ApplicationServices" connectionString="Server=myserverAddress;Port=3306;Database=myDatabaseName;uid=myUserName;Pwd=myPassword" />
</connectionStrings>

The error message you've got indicates this as well,

The requested page cannot be accessed because the related configuration data for the page is invalid.

Hope this helps!

There's an article covering the subject "how to use web.config for connection strings" at the address,
http://www.connectionstrings.com/store-connection-string-in-webconfig/

Good luck!