我最近启动了一个使用Entity Framework Core进行数据库通信的ASP.NET核心Web应用程序(WebAPI),只要我在我的开发环境中运行我的笔记本电脑上的应用程序,一切都运行得非常顺利.
使用Ubuntu服务器(16.04.3 LTS)托管Web应用程序和数据库.我安装了最新的sql server(Microsoft SQL Server 2017(RC2) - 14.0.900.75(X64)),只要应用程序在windows上运行,我就可以从我的应用程序连接到它.但是,在Ubuntu上使用相同的代码和连接字符串,所有查询都会超时.我得到以下输出(异常/堆栈跟踪):
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HL6RV4D2F9I6": An unhandled exception was thrown by the application.
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception: Unknown error 258
--- End of inner exception stack trace ---
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
at System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync()
at System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket()
at …Run Code Online (Sandbox Code Playgroud)