0

我在尝试使用 mysql .net 连接器连接到 blogengine (1.5.0) 的 mysql 数据库时遇到问题。

我收到“无法连接到任何指定的 MySQL 主机”错误。

[SocketException (0x273d): The attempted operation is not supported for the type of object referenced] System.Net.Sockets.Socket.get_ConnectEx() +305 System.Net.Sockets.Socket.BeginConnectEx(EndPoint remoteEP, Boolean flowContext, AsyncCallback callback, Object state) +479 System.Net.Sockets.Socket.BeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state) +125 MySql.Data.Common.StreamCreator.CreateSocketStream(IPAddress ip, Boolean unix) +187 MySql.Data.Common.StreamCreator.GetStream(UInt32 timeout) +495 MySql.Data.MySqlClient.NativeDriver.Open() +234

[MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.] MySql.Data.MySqlClient.NativeDriver.Open() +299 MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) +48 MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() +11 MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() +190 MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() +129 MySql.Data.MySqlClient.MySqlPool.GetConnection() +106 MySql.Data.MySqlClient.MySqlConnection.Open() +293 BlogEngine.Core.Providers.DbBlogProvider.LoadSettings() +201 BlogEngine.Core.BlogSettings.Load() +63 BlogEngine.Core.BlogSettings..ctor() +25 BlogEngine.Core.BlogSettings.get_Instance() +29 BlogEngine.Core.Web.HttpModules.ReferrerModule..cctor() +71

[TypeInitializationException: The type initializer for 'BlogEngine.Core.Web.HttpModules.ReferrerModule' threw an exception.]

[TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +86 System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +230 System.Activator.CreateInstance(Type type, Boolean nonPublic) +67 System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1051 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111 System.Web.Configuration.Common.ModulesEntry.Create() +39 System.Web.Configuration.HttpModulesSection.CreateModules() +164 System.Web.HttpApplication.InitModules() +28 System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +729 System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +298 System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +289

到目前为止我做了什么:

1)试图连接到我的共享主机mysql帐户

2)尝试连接到我的本地主机服务器

3) 尝试将 .net 连接器从版本 5.1.7 更改为 6.0.5

4)尝试重新启动IIS

我仍然收到错误。我可以使用 mysql 管理员 n 查询浏览器连接到两个服务器(共享 n 本地)。所以这不可能是防火墙问题,而且我已经启用了端口 3306。

以前有人经历过这样的事情吗?谢谢。

4

1 回答 1

0

我想我发现了问题。它与我的winsock有关。它被破坏了。

所以我所做的只是 netsh winsock 重置。重启电脑,我就可以连接到数据库了。

于 2009-12-16T06:05:44.850 回答