当我指定协议和端口时,Sql Server 2005 只能在 ASP.NET 1.1 中访问

发布于 2024-07-08 05:16:30 字数 405 浏览 6 评论 0原文

我的公司目前正在将一些非常旧的数据库迁移到 sql server 2005。一些旧版应用程序在连接到新服务器时出现问题。 连接字符串在 Asp.NET 2.0 中有效,可能是因为它自动假定 tcp:1433。

我必须在 ASP.NET 1.1 中构造这样的连接字符串才能使其工作:

"Server=tcp:my.server.com,1433;..."

如果没有协议和端口,连接将失败(“无效连接异常”)

TCP 1433 和 UDP 1434 在我们的防火墙上打开。 在 SQL Server 2005 上,远程访问已启用,TCPIP 也已启用,SQL 浏览器服务正在运行,我使用正确的登录凭据。

为什么我不能只指定没有协议和端口号的服务器名称,有什么想法吗?

My company is currently migrating some of their really old db's to sql server 2005. Some legacy apps have problems connecting to the new server. The connection string works in Asp.NET 2.0, probably because it assumes tcp:1433 automatically.

I have to construct the connection string like this in ASP.NET 1.1 for it to work:

"Server=tcp:my.server.com,1433;..."

Without the protocol and the port, the connection fails ("Invalid Connection exception")

TCP 1433 and UDP 1434 are open on our firewall. On SQL Server 2005 Remote Access is enabled, so is TCPIP, the SQL Browser service is running, I use the proper login credentials.

Any ideas why I can't just specify the server name without protocol and port number?

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

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

发布评论

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

评论(3

蝶…霜飞 2024-07-15 05:16:30

IIRC SQL Server 2005 默认查找任何可用的旧端口。 在我的笔记本电脑上,这意味着端口 1212。

​​要强制它到特定端口,您必须转到“开始”->“程序”->“SQL Server 2005”->“配置工具”->“SQL Server 配置管理器”

从这里您必须转到 SQL Server 2005 网络配置->协议(服务名称)->右键单击 TCP/IP->属性->选择选项卡“IP 地址”并将 TCP 动态端口设置为 。

由于某种原因,“0”表示“是,使用动态端口”并且(即字段中没有条目)表示“否,我会自己指定它”

然后在 TCP 端口字段中填写 1433。对

列出的所有适配器执行此操作,然后重新启动 SQL 服务。

现在,您可以通过执行以下操作来检查服务是否确实位于正确的端口:

开始->运行->cmd.exe

C:>netstat -ano

查找类似这样的条目

 local address         <stuff>           PID
 0.0.0.0:1433                            <some number>

现在执行
C:>任务列表

并查找上面编号的任务。 该任务的名称应类似于 sqlsrvr.exe。

IIRC SQL Server 2005 defaults to find any-old-port that is available. On my laptop this means port 1212.

To force it to a specific port you must go to Start->Programs->SQL Server 2005->Configuration Tools->SQL Server Configuration Manager

From here you must go to SQL Server 2005 Network Configuration->Protocols for (name of service)->Right click on TCP/IP->Properties->Choose tab "IP Address" and set TCP Dynamic Ports to .

For some reason "0" means "Yes, use dynamic ports" and (i.e. no entry in field) menas "No, I will specify it myself"

Then fill in the field TCP Port with 1433.

Do so on all adapters that are listed, and restart the SQL Service.

You can now check if the service is indeed on the right port by doing the following

Start->Run->cmd.exe

C:>netstat -ano

look for an entry like this

 local address         <stuff>           PID
 0.0.0.0:1433                            <some number>

Now do
C:>tasklist

and look for the task with the number from above. This task should be called something like sqlsrvr.exe.

各空 2024-07-15 05:16:30

也许您的 SQL Server 配置为多协议,并且它尝试首先使用其他协议并失败,可能是出于某种安全原因(应用程序在 IIS 中运行的帐户)。 只是一个猜测。

Perhaps your SQL Server is configured for multi-protocol, and it's trying to use the other protocol first and failing, perhaps for some security reason (the account that the app is running as in IIS). Just a guess.

離殇 2024-07-15 05:16:30

检查 ASP.NET 计算机上“SQL 配置管理器”中的“SQL Native Client 配置”设置。 默认连接设置在那里设置。 还可以尝试弄乱 MDAC 配置:

http://msdn.microsoft.com/ en-us/library/ms131035.aspx

Check the "SQL Native Client Configuration" settings in "SQL Configuration Manager" on the ASP.NET machine. The default connection settings are set there. Also try messing with the MDAC configuration:

http://msdn.microsoft.com/en-us/library/ms131035.aspx

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