我已经尝试解决这个问题好几天了,所以我在这里尝试看看是否还有其他想法可以尝试。
我可以很好地连接到本地SQL Express,但是当尝试使用单独的VPN连接到位于两个不同公司的SQL时,无法从.NET Core / VS Code / dotnet.exe访问。
我在老板提供的新笔记本电脑上遇到此问题。
到目前为止我为解决这个问题所做的尝试:
appSettings.json
中的ConnectionString在运行代码时实际使用(调试时检查)ConnectionString格式:
的错误:"DefaultConnection": "Server=<IPToServer>;Database=<DBName>;User ID=<UserName>;Pwd=<Password>"
都不是命名实例,一个是SQL Express,一个是SQL Server。
没有tcp:
的错误:A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) System.ComponentModel.Win32Exception (1326): The user name or password is incorrect
但是用户名和密码不正确。当也切换到名称管道时,我也从MSSMS收到该消息,但是当更改为TCP时,我可以连接(从MSSMS)。
tcp:
An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseSqlServer' call. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)
任何人有什么想法可以尝试吗?由于它可以在我的另一台计算机上工作,因此我可以肯定是笔记本电脑上的某种原因导致了它。
我已经尝试解决这个问题好几天了,所以我在这里尝试看看是否还有其他想法可以尝试。我可以很好地连接到本地SQL Express,但是尝试连接到位于...