.NET Core 2 - Connection string with instance name and port number

这一生的挚爱 提交于 2020-06-28 08:15:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!