[Mono-winforms-list] SQL SERVER 2008 - IDbConnection.Open exception

ManuteBall ridick13 at gmail.com
Tue Jun 26 17:04:49 UTC 2012


Hi,

I am porting an existing .net app to be ran in macosx.

Both my code and example code in(http://www.mono-project.com/SQLClient fail
with same error:

 public class Test
    {
        public Test()
        {
          string connectionString = "Server=DEV-PC\\SQLEXPRESS;" +
          "Database=DBIntranet;" +
          "User ID=user;" +
          "Password=pwd;";
            IDbConnection dbcon;
           
            using (dbcon = new SqlConnection(connectionString))
            {
                try
                {
                    dbcon.Open();
                }catch (Exception e)
                {
                    Clipboard.SetText(e.Message + " " + e.InnerException + " 
" + e.ToString());
                   }
             ....

This code works fine when "normal-run" in VS2010 but fails when mono-run.
Here's the exception:

An existing connection was forcibly closed by the remote host.
   System.Net.Sockets.SocketException: An existing connection was forcibly
closed by the remote host.

  at System.Net.Sockets.Socket.ReceiveFrom_nochecks_exc (System.Byte[] buf,
Int32 offset, Int32 size, SocketFlags flags, System.Net.EndPoint&
remote_end, Boolean throwOnError, System.Int32& error) [0x000be] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\System\System.Net.Sockets\Socket.cs:1758 
  at System.Net.Sockets.Socket.ReceiveFrom_nochecks (System.Byte[] buf,
Int32 offset, Int32 size, SocketFlags flags, System.Net.EndPoint&
remote_end) [0x00000] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\System\System.Net.Sockets\Socket.cs:1717 
  at System.Net.Sockets.Socket.ReceiveFrom (System.Byte[] buffer,
System.Net.EndPoint& remoteEP) [0x0004a] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\System\System.Net.Sockets\Socket.cs:1648 
  at System.Net.Sockets.UdpClient.Receive (System.Net.IPEndPoint& remoteEP)
[0x0001d] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\System\System.Net.Sockets\UdpClient.cs:332 
  at System.Data.SqlClient.SqlConnection+SqlMonitorSocket.DiscoverTcpPort
(Int32 timeoutSeconds) [0x000aa] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\System.Data\System.Data.SqlClient\SqlConnection.cs:986 
  at System.Data.SqlClient.SqlConnection.DiscoverTcpPortViaSqlMonitor
(System.String ServerName, System.String InstanceName) [0x00008] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\System.Data\System.Data.SqlClient\SqlConnection.cs:653 
  at System.Data.SqlClient.SqlConnection.ParseDataSource (System.String
theDataSource, System.Int32& thePort, System.String& theServerName)
[0x0007e] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\System.Data\System.Data.SqlClient\SqlConnection.cs:597 
  at System.Data.SqlClient.SqlConnection.Open () [0x000c2] in
C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.8\mcs\class\System.Data\System.Data.SqlClient\SqlConnection.cs:546 
  at CeydeWM.Classes.Test..ctor () [0x0001a] in CeydeWM\Classes\Test.cs:25 


thanks guys


--
View this message in context: http://mono.1490590.n4.nabble.com/SQL-SERVER-2008-IDbConnection-Open-exception-tp4650181.html
Sent from the Mono - WinForms mailing list archive at Nabble.com.


More information about the Mono-winforms-list mailing list