在Azure的网站间歇性的MySQL连接错误 [英] Intermittent MySQL Connection Error in Azure Website

查看:522
本文介绍了在Azure的网站间歇性的MySQL连接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从使用到精致小巧的MySQL查询我的ASP.Net MVC Web应用程序的调用时收到以下错误间歇性。

I'm getting the following error intermittently when making a call from my ASP.Net MVC web application which is using Dapper to query MySQL.

无法连接到任何指定的MySQL主机。

Unable to connect to any of the specified MySQL hosts.

的异常的只有的时候,我的web应用程序发布到Azure的发生。它的工作100%的时间,当我运行code本地。我已经部署了code到第二蔚蓝的网站,并得到异常那里,又断断续续。

The exception only occurs when my web app is published to Azure. It has worked 100% of the time when I run the code locally. I've deployed the code to a second azure website, and also get the exception there, again intermittently.

MySQL数据库是在一个蓝色的VM(Ubuntu的)上运行。该服务器还具有正在以设定的间隔运行访问数据库一些ř脚本。我要么不得不与这些无连接的问题。这仅仅是净code,它的挣扎。

The MySQL database is running on an Azure VM (Ubuntu). This server also has some R scripts that access the database, which are being run at a set interval. I've had no connectivity issue with these either. It is just the .Net code that's struggling.

我已经冲刷网页,但不觉得我已经打开了任何有价值的东西。大多数链接都指向一个连接字符串的问题,但由于间歇工作似乎并不适合我的问题。有些链接已引用DNS的问题,但我得到了同样的问题,当我使用的IP地址而不是机器名的DNS服务器。

I've scoured the web, but don't feel like I've turned up anything of value. Most of the links have pointed to a connection string problem, but since it works intermittently that doesn't seem to fit my problem. Some links have referenced DNS issues, but I'm getting the same problem when I use the IP Address instead of the machine name for the DNS server.

我敢肯定,我需要跟踪更多的信息,但我不知道哪里会。这是我首次涉足以这种方式使用MySQL数据库,我不熟悉的配置选项或者在这方面的事情日志文件。我觉得同样有关与数据库交互太Azure的网站。

I'm sure I need to track down more information, but I'm not sure where it would be. This is my first foray into using a MySQL db in this fashion, and I'm not familiar with config options or log files on that side of things. I feel similarly about Azure websites with database interactions too.

我可以尝试下?

只需开车回家有关此错误是间歇性的点,这里是从的命中页面(从而引发MySQL查询)每5分钟Runscope工作截图:

推荐答案

我是能够解决(或者规避),这一问题通过添加 - 跳过主机缓存标志对我们的mysql的配置文件。我还是不完全了解问题的根源是什么,但由于补充说,我们还没有从Azure的网站的MySQL连接的任何问题。

I was able to fix (or perhaps "circumvent") this problem by adding the --skip-host-cache flag to our mysql configuration file. I still don't fully understand what the root of the problem is, but we haven't had any issues with MySQL connectivity from the Azure website since adding that.

这篇关于在Azure的网站间歇性的MySQL连接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆