简体   繁体   English

使用SQL Alias连接到SQL Server的问题

[英]Issue connecting to SQL Server using SQL Alias

I created an SQL Alias: 我创建了一个SQL别名:

Name: CIHDB
Server: SQLSRV
Protocol: tcp
Port no: (empty)

My connection string within Visual Studio says: 我在Visual Studio中的连接字符串说:

Data Source=CIHDB;Initial Catalog=CIH;Integrated Security=SSPI;MultipleActiveResultSets=True;Application Name=EntityFramework

But that fails with the error: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it. 但是由于错误而失败: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.

When I change the "Data Source" in the connection string to "localhost," I connect with no problem. 当我将连接字符串中的“数据源”更改为“localhost”时,我连接没有问题。

I am thinking that I am using the wrong protocol in the Alias. 我在想我在Alias中使用了错误的协议。

Can anybody shed some light on this? 任何人都可以对此有所了解吗?

Thanks Eric 谢谢Eric

When I used both 我两个都用的时候

cliconfg.exe

and

c:\\windows\\syswow64\\cliconfg.exe

(64 and 32 bit versions of cliconfg.exe) (64位和32位版本的cliconfg.exe)

I saw that tcp/ip was not enabled and so once I fixed that, all fell into place. 我看到tcp / ip没有启用,所以一旦我解决了,所有都落到了位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM