Lost connection to MySQL server during query - 2

Lost connection to MySQL server during query - 2

Postby ahandgraaf » Fri 04 Apr 2008 18:11

Using VS2008, C#, ASP.Net 2 with AspNetMySqlMembershipProvider / AspNetMySqlRoleProvider / AspNetMySqlProfileProvider / CoreLab.Data 4.50.21 and CoreLab.MySql(.Web) 4.50.25.

The web.config is copy/paste from the examples.

Every 20-25 pageviews I get a
"Lost connection to MySQL server during query" - Server Error

Where the source points to the row with:
MembershipUser user = Membership.GetUser();

I have to use a shared MySQL 5 server and have no influence whatsoever on the configuration (My ISP says it works for thousends of sites without problems, so the problem is on your site).

In my testserver/environment it works without problem I can do hunderds requests a minute without any problem.

Is there something I can configure on 'my' site so the providers start working as they should or can I better use MsSQL Express for the provider part and for the other databasestuff MySQL. I can program around lost connections in my normal pages, but don't know if I or how I can do that for the provider part.

Any help/suggestions are welcome!
ahandgraaf
 
Posts: 3
Joined: Sun 15 Apr 2007 05:56

Postby Alexey.mdr » Mon 07 Apr 2008 09:40

Could you provide a block of code where the exception is thrown?
We need to determine which size drops a connection.
Usually, it's the problem of either MySqlConnection.Timeout or MySqlCommand.Timeout property on the client side.
Try increasing their values.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24

The code

Postby ahandgraaf » Tue 08 Apr 2008 10:52

MembershipUser user = Membership.GetUser();

I don't know exactly where I can manage the settings used by the providers.

In the web.config the following connectionstring is used for the providers:


On my pages I have many queries against the database using the same connectionstring and the connections are never lost, only sometimes when the membership or role provider uses the connection to the database.

BTW: in my testenviroment I'm never able to get those connection Lost errors, but I guess that MySQL-server is configured better then my ISP's or less busy.
ahandgraaf
 
Posts: 3
Joined: Sun 15 Apr 2007 05:56

Postby Alexey.mdr » Tue 08 Apr 2008 13:29

Check that you have explicitly called all MyDataReader.Close();
Do you use multithreading?
Do you connect in Direct mode?
Probably (and it's likely the source of the problem),
the same connection is used by several controls at the same time.
Try using different connections for data loading and memberships/roles.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24


Return to dotConnect for MySQL