blogengine 和 mysql .net 连接器 - 无法连接到数据库

发布于 2024-08-15 14:22:28 字数 2939 浏览 5 评论 0原文

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

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

<代码> [SocketException (0x273d): 引用的对象类型不支持尝试的操作] System.Net.Sockets.Socket.get_ConnectEx() +305 System.Net.Sockets.Socket.BeginConnectEx(端点remoteEP,布尔flowContext,AsyncCallback回调,对象状态)+479 System.Net.Sockets.Socket.BeginConnect(EndPoint remoteEP,AsyncCallback回调,对象状态)+125 MySql.Data.Common.StreamCreator.CreateSocketStream(IPAddress ip, Boolean unix) +187 MySql.Data.Common.StreamCreator.GetStream(UInt32超时)+495 MySql.Data.MySqlClient.NativeDriver.Open() +234

[MySqlException (0x80004005): 无法连接到任何指定的 MySQL 主机。] MySql.Data.MySqlClient.NativeDriver.Open() +299 MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder 设置)+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: 'BlogEngine.Core.Web.HttpModules.ReferrerModule' 的类型初始值设定项引发了异常。]

[TargetInitationException: 已引发异常调用的目标。] System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0 System.RuntimeType.CreateInstanceSlow(布尔publicOnly,布尔fillCache)+86 System.RuntimeType.CreateInstanceImpl(布尔publicOnly,布尔skipVisibilityChecks,布尔fillCache)+230 System.Activator.CreateInstance(类型类型,布尔非公共)+67 System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,活页夹活页夹,对象[]参数,CultureInfo文化,对象[]激活属性)+1051 System.Activator.CreateInstance(类型类型,BindingFlags bindingAttr,活页夹活页夹,对象[] args,CultureInfo文化,对象[]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上下文,HttpApplicationState状态,MethodInfo []处理程序)+729 System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext上下文)+298 System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext上下文)+107 System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)+289 到目前为止

我做了什么:

1)尝试连接到我的共享托管mysql帐户

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

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

4)尝试重新启动IIS

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

有人以前经历过类似的事情吗?谢谢。

ive got a problem when trying to connect to a mysql db for blogengine (1.5.0) using mysql .net connector.

im getting "Unable to connect to any of the specified MySQL hosts" error.


[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

what ive done so far:

1)tried to connect to my shared hosting mysql account

2)tried connect to my localhost server

3)tried changing .net connector from versoin 5.1.7 until 6.0.5

4)tried restarting IIS

and im still getting the error. i could connect to both server (shared n local) using mysql administrator n query browser. so theres no way its a firewall issue plus i already enable port 3306.

anyone experienced something like this before ? thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

要走干脆点 2024-08-22 14:22:28

我想我发现了问题。这和我的winsock有关。它被损坏了。

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

i guess i found the problem. its got to do with my winsock. it was corrupted.

so all i did was netsh winsock reset . restart the pc, and i can connect to the db.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文