blogengine和mysql .net连接器 - 无法连接到db

时间:2009-12-16 05:26:54

标签: mysql blogengine.net

尝试使用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)尝试连接到我的localhost服务器

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

4)尝试重启IIS

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

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

1 个答案:

答案 0 :(得分:0)

我猜我发现了这个问题。它与我的winsock有关。它已经腐败了。

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