简体   繁体   中英

Can't connect to SQL Server alias from local app

I have a SQL Server instance named OldServer\\Instance and one named NewServer . I need to send all of the apps that are currently referencing OldServer\\Instance to use the new one instead.

I'm testing this concept by adding an alias on my local machine on NewServer of "OldServer" and creating an application that reads and makes updates to a table.

I have created the alias (TCP, port 1433) and tested that I can connect to it with a Data Link successfully. When I made my Windows Forms app to connect to it, it still connects to OldServer\\Instance .

Is there something I'm missing in IIS? Is it not possible to alias with an instance? Here is my connection string:

<add name="ConnectionString" connectionString="server=OldServer\Instance;database=MyDB;UID=MyUser;Pwd=1234;"  providerName="System.Data.SqlClient"  />

Please try to clean DNS cache on the machine you are testing.

Click Start.
Enter cmd in the Start menu search text box.
Right-click Command Prompt and select Run as Administrator.
Run the following command: ipconfig /flushdns. 

and run your code again

BTW, OldServer on of Off?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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