MS-SQL communication in dotnet core under linux throwing errors

0

Im running on the default port 1433. when I execute a simple query against the DB all works well. but when I try to run a stored procedure .. like this:

DataTable result = null;

SqlCommand command = new SqlCommand();
command.CommandType = System.Data.CommandType.StoredProcedure;
command.CommandText = procedureNameWithDbVersionPrefix;
command.CommandTimeout = m_nTimeout;
foreach (string item in m_Parameters.Keys)
{
    command.Parameters.Add(new SqlParameter(item, m_Parameters[item]));
}
string sConn = GetConnectionString();
using (SqlConnection con = new SqlConnection(sConn))
{
    try
    {
        con.Open();
        command.Connection = con;

        SqlQueryInfo queryInfo = Utils.GetSqlDataMonitor(command);
        using (KMonitor km = new KMonitor(KLogMonitor.Events.eEvent.EVENT_DATABASE, null, null, null, null) { Database = queryInfo.Database, QueryType = queryInfo.QueryType, Table = queryInfo.Table, IsWritable = (m_bIsWritable || Utils.UseWritable).ToString() })
        {
            using (SqlDataReader reader = command.ExecuteReader())
            {
                if (reader.HasRows)
                {
                    result = new DataTable();
                    result.Load(reader);
                }
            }
        }

        con.Close();
    }
    catch (Exception ex)
    {
        string sMes = "While running : '" + procedureNameWithDbVersionPrefix + "'\r\n Exception occurred: " + ex.Message;
        log.Error(sMes, ex);
        return null;
    }
}

I'm getting this exception only on Linux system. running on windows all works well.. actually event running inside a Linux based docker on windows all works well .. :\

ERROR 2019-04-23 06:49:53,933 (33) class:ODBCWrapper.StoredProcedure topic:null method:UpdateBulkUpload server:c931619e64e0 ip:null reqid:35a07e86-933a-4f0c-93ec-3428e4d92687 partner:203 action:null uid:770357 msg:While running : '__522v0__UpdateBulkUpload'
 Exception occurred: A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 35 - An internal exception was caught)
System.Data.SqlClient.SqlException (0x80131904): A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 35 - An internal exception was caught) ---> System.IO.IOException: Unable to write data to the transport connection: Operation canceled. ---> System.Net.Sockets.SocketException: Operation canceled
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset, Int32 size)
   at System.Data.SqlClient.SNI.SNITCPHandle.Send(SNIPacket packet)
   at System.Data.SqlClient.SqlConnection.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.SNIWritePacket(Object packet, UInt32& sniError, Boolean canAccumulate, Boolean callerHasConnectionLock)
   at System.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean canAccumulate)
   at System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode, Boolean canAccumulate)
   at System.Data.SqlClient.TdsParserStateObject.ExecuteFlush()
   at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc, Boolean sync, TaskCompletionSource`1 completion, Int32 startRpc, Int32 startParam)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.SqlClient.SqlCommand.ExecuteReader()
   at ODBCWrapper.StoredProcedure.Execute(Boolean shouldGoToSlave) in /src/Core/ODBCWrapper/StoredProcedure.cs:line 130
linux
.net-core
sqlclient
asked on Stack Overflow Apr 23, 2019 by Mortalus

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0