问题
In my application I have a connection string in the config. This application created using .NET core 2.11 and SQL Server. This is the connection string:
Data Source=servername\instancename, portnumber;Initial Catalog=dbname;Persist Security Info=True;User ID=username;Password=password;
This string causes an error as shown here:
This error happens if I use instance name and port number in the string. If I remove either one, it is working. So, how do I make it work to used both instance name and port number in the connection string?
回答1:
Found the answer. Instance name will be use dynamic port, so I cannot use default port number (1433). Need to change the port number to used 1433 instead of the dynamic port.
来源:https://stackoverflow.com/questions/55292747/net-core-2-connection-string-with-instance-name-and-port-number