- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我在 .NET 控制台应用程序中有一段简单的代码,它试图打开与服务器的 SQL 连接:
using (SqlConnection connection = new SqlConnection("<my connection string>"))
{
connection.Open();
}
它在我的 Windows 7 机器上运行良好,但在我的另一台运行 Windows XP x64 的机器上,对 Open() 的调用无限期挂起。
知道为什么会发生这种情况,或者我如何诊断原因?我在两台计算机上都从管理员帐户运行该程序。
编辑:好的,这似乎是防火墙问题。我已将我的 Windows 7 机器连接到与 Windows XP 机器相同的互联网连接,现在它也挂起...我需要打开哪些端 Eloquent 能让 SQL 流量通过,我该如何打开它们?
编辑:以防万一有人感兴趣,我的网络管理员出于对 Slammer 蠕虫的恐惧而阻止了到端口 1433 的传出流量......
最佳答案
因为我可以 ping 并尝试连接到 database2.ehost-services.com(虽然我收到登录失败),让我们尝试简化您的连接字符串:
Data Source=database2.ehost-services.com;Initial Catalog=myDatabaseName;User ID=myUser;Password=myP@ssword;
编辑
要回答有关连接字符串为何未超时的问题,MSDN描述连接字符串的pooling
属性如下:
When the value of this key is set to true, any newly created connection will be added to the pool when closed by the application. In a next attempt to open the same connection, that connection will be drawn from the pool.
Connections are considered the same if they have the same connection string. Different connections have different connection strings.
The value of this key can be "true", "false", "yes", or "no".
所以我在想,也许您的连接实例实际上还没有被合并到超时。
编辑
从您的错误消息来看,您似乎使用的是 NAMED PIPES 而不是 TCP/IP。也许this可以帮助你(使用 SQL Server 配置管理器来选择你的协议(protocol))。在 [SQL Native Client 9.0/10.0 Configuration] 下检查,您应该会看到一个协议(protocol)列表。确保 TCP/IP 在命名管道之前以顺序列出并且也已启用。例如,我的顺序 1 - 3 是共享内存、TCP/IP、命名管道和禁用 VIA。
编辑
尝试创建一个选择了 TCP/IP 协议(protocol)的别名并连接到您的别名?您也可以使用 SQL Server 配置管理器执行此操作。
编辑
由于OP已经解决了这个问题,我确实对别人的回答发表了评论:
A security policy that blocks outgoing would have to be explicitly created
SOB,就是这样 - 网络管理员阻止了端口 1433 上的传出流量。很高兴你知道了!
关于c# - SqlConnection.Open() 在 Windows XP 上挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4893786/
OpenAL.org && 创意开发网站已关闭。我选择替代版本 OpenAL Soft .我很担心,因为在 OpenAL Soft 的二进制安装中我找不到 alut.h header 。 alut.h
我使用 Android Studio 已经有一段时间了,但有一天应用程序突然出错了。当我尝试单击我的目录以查找要导入或打开的文件时,应用程序变得异常缓慢并且根本没有响应。当我最终成功切换到存储我的文件
自 Firefox 4 以来,这似乎是一个奇怪的功能变化。在使用 window.open() 打开一个窗口后,当用鼠标中键单击打开的窗口中的链接时(或右键单击并选择“在新窗口中打开”选项卡') 导致链
我无法从 Open::URI 的 rdoc 中得知当我这样做时返回的是什么: result = open(url) URL 返回 XML,但我如何查看/解析 XML? 最佳答案 open 返回一个 I
经常开发asp但对于细致的说法,真实不太清楚,这里简单的介绍下。 一般情况下 读取数据都是用rs.open sql,conn,1,1 修改数据:rs.open sql,conn,1,3 删除
关于 pathlib 标准库中的模块,是 path.open() 方法只是内置 open() 的“包装器”功能? 最佳答案 如果您阅读了 source code的 pathlib.Path.open你
我想将 Open Liberty 运行时的语言更改为 en_US从 Eclipse IDE 中,但我不知道如何。 也尝试使用 JVM 参数的首选项来设置它,但它没有用。 -Duser.language
这是我所拥有的: 参数“opener”未在可能的函数调用参数中列出。这是 PyCharm 错误还是其他原因? PyCharm 2018.3.5 社区版,Windows 7 上的 Python 3.6.
我正在使用 Tinkerpop 的 GraphFactory.open(Configuration 配置) Java 命令来访问 Neo4j 数据库。 一个最低限度的工作示例是: Configurat
这个问题在这里已经有了答案: What is the python "with" statement designed for? (11 个答案) 关闭 7 年前。 我没有使用过 with 语句,但
我正在玩 python 3.5 中的 open 函数。我不明白 opener 参数(最后一个参数)在 open 函数中的用法。根据 python 文档:可以通过将可调用对象作为打开器传递来使用自定义打
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 5 年前。 Improve th
我试图用 Python 来做一些模拟 3D 声音的工作。我试图运行此代码(答案中提供):Python openAL 3D sound类似,两次都收到: ModuleNotFoundError: No
我一直认为 open 和 io.open 可以互换。 显然不是,如果我相信这个片段: import ctypes, io class POINT(ctypes.Structure): _fie
这个问题在这里已经有了答案: What's the difference between io.open() and os.open() on Python? (7 个答案) 关闭 9 年前。 我是
我正在尝试更好地了解 WCF 的一些内部工作原理。我已经做了相当多的环顾四周,但我无法找到关于 ChannelFactory.Open() 与 IClientChannel.Open() 相比的明确解
这个问题在这里已经有了答案: What is the python "with" statement designed for? (11 个答案) 关闭 7 年前。 我知道有很多关于在 python
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界. 这篇CFSDN的博客文章adodb.recordset.open(rs.open)方法参数详解由
不久前我遇到了一个interesting security hole Link 看起来足够无害,但有一个漏洞,因为默认情况下,正在打开的页面允许打开的页面通过 window.opener 回调到它。有
这在我的应用程序上运行良好,但由于某种原因我无法让它在这里正常工作。无论如何,我的问题是,当我单击列表标题时,我想关闭之前打开的列表标题并仅保留事件的列表标题打开。目前它会打开我点击的所有内容,但也会
我是一名优秀的程序员,十分优秀!