Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    ProGet - Could not open a connection to SQL Server

    Scheduled Pinned Locked Moved Support
    4 Posts 2 Posters 28 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      tamir.dahan_7908
      last edited by atripp

      Hi

      I'm trying to install ProGet version 24.0.10.5 in my docker environment

      following the instructions from inedo documentation
      https://docs.inedo.com/docs/installation/linux/docker-guide

      after i ran the flowing commands

      docker run --name inedo-sql -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=mypassword'  -e 'MSSQL_PID=Express' --net=inedo --restart=unless-stopped   -d mcr.microsoft.com/mssql/server:latest
      
      docker exec -it inedo-sql /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'mypassword' -Q 'CREATE DATABASE [ProGet] COLLATE SQL_Latin1_General_CP1_CI_AS'
      

      I can see that I have 2 containers up and running
      but the proget container cannot succeed to start successfully

      CONTAINER ID   IMAGE                                                COMMAND                  CREATED          STATUS          PORTS                                        NAMES
      ce9547b183fa   proget.inedo.com/productimages/inedo/proget:latest   "/bin/sh -c '/usr/lo…"   15 minutes ago   Up 28 seconds   0.0.0.0:80->80/tcp, :::80->80/tcp, 443/tcp   proget
      22ed0ef2c195   mcr.microsoft.com/mssql/server:latest                "/opt/mssql/bin/perm…"   22 minutes ago   Up 22 minutes   1433/tcp                                     inedo-sql
      

      the logs from the Db looks OK

      2024-07-21 08:14:14.44 spid12s     Database 'msdb' running the upgrade step from version 956 to version 957.
      2024-07-21 08:14:14.46 spid14s     Database 'model' running the upgrade step from version 956 to version 957.
      2024-07-21 08:14:14.54 spid14s     Clearing tempdb database.
      2024-07-21 08:14:14.77 spid14s     [2]. Feature Status: PVS: 0. CTR: 0. ConcurrentPFSUpdate: 1. ConcurrentGAMUpdate: 1. ConcurrentSGAMUpdate: 1, CleanupUnderUserTransaction: 0. TranLevelPVS: 0
      2024-07-21 08:14:14.77 spid14s     Starting up database 'tempdb'.
      2024-07-21 08:14:14.86 spid32s     The Service Broker endpoint is in disabled or stopped state.
      2024-07-21 08:14:14.87 spid32s     The Database Mirroring endpoint is in disabled or stopped state.
      2024-07-21 08:14:14.88 spid32s     Service Broker manager has started.
      2024-07-21 08:14:14.88 spid12s     Recovery is complete. This is an informational message only. No user action is required.
      2024-07-21 08:14:14.90 spid22s     The default language (LCID 0) has been set for engine and full-text services.
      2024-07-21 08:16:52.28 spid79      [5]. Feature Status: PVS: 0. CTR: 0. ConcurrentPFSUpdate: 1. ConcurrentGAMUpdate: 1. ConcurrentSGAMUpdate: 1, CleanupUnderUserTransaction: 0. TranLevelPVS: 0
      2024-07-21 08:16:52.28 spid79      Starting up database 'ProGet'.
      2024-07-21 08:16:52.28 spid79      RemoveStaleDbEntries: Cleanup of stale DB entries called for database ID: [5]
      2024-07-21 08:16:52.28 spid79      RemoveStaleDbEntries: Cleanup of stale DB entries skipped because master db is not memory optimized. DbId: 5.
      2024-07-21 08:16:52.31 spid79      Parallel redo is started for database 'ProGet' with worker pool size [1].
      2024-07-21 08:16:52.33 spid79      Parallel redo is shutdown for database 'ProGet' with worker pool size [1].
      RecoveryUnit::Shutdown. IsOnline: 02024-07-21 08:20:53.17 spid67      XE session 'telemetry_xevents' started.
      2024-07-21 08:30:54.02 spid66      Attempting to load library 'xplog70.dll' into memory. This is an informational message only. No user action is required.
      2024-07-21 08:30:54.03 spid66      Using 'xplog70.dll' version '2022.160.4125' to execute extended stored procedure 'xp_msver'. This is an informational message only; no user action is required.
      2024-07-21 08:34:14.24 spid66      [5]. Feature Status: PVS: 0. CTR: 0. ConcurrentPFSUpdate: 1. ConcurrentGAMUpdate: 1. ConcurrentSGAMUpdate: 1, CleanupUnderUserTransaction: 0. TranLevelPVS: 0
      2024-07-21 08:34:14.24 spid66      Starting up database 'ProGet'.
      2024-07-21 08:34:14.24 spid66      RemoveStaleDbEntries: Cleanup of stale DB entries called for database ID: [5]
      2024-07-21 08:34:14.24 spid66      RemoveStaleDbEntries: Cleanup of stale DB entries skipped because master db is not memory optimized. DbId: 5.
      2024-07-21 08:34:14.28 spid66      Parallel redo is started for database 'ProGet' with worker pool size [1].
      2024-07-21 08:34:14.29 spid66      Parallel redo is shutdown for database 'ProGet' with worker pool size [1].
      

      but the server can not commentate with the DB

      ProGet version is 24.0.10.5.
      Current DB schema version is unknown.
      Unhandled exception: Microsoft.Data.SqlClient.SqlException (0x80131904): 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: 40 - Could not open a connection to SQL Server)
         at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
         at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
         at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
         at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
         at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
         at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
         at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
         at Microsoft.Data.SqlClient.SqlConnection.Open()
         at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.GetConnection()
         at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.ExecuteTable[TResult](String query, Func`2 adapter, SqlTransaction transaction, SqlParameter[] args)
         at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.GetChangeScriptVersion(SqlTransaction transaction)
         at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.GetState()
         at Inedo.DbUpdater.ConsoleHost.Update(String scriptPath, String connectionString, Boolean force)
         at Inedo.DbUpdater.ConsoleHost.Run(ArgList args)
         at Inedo.DbUpdater.ConsoleHost.RunAsync(IEnumerable`1 args)
         at Inedo.ProGet.Service.Program.UpdateDatabaseSchemaAsync() in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E463691\Src\ProGet.Service\Program.cs:line 318
         at Inedo.ProGet.Service.Program.Run(WebServerMode mode, Boolean runAsService, Boolean linuxContainer, String urls) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E463691\Src\ProGet.Service\Program.cs:line 28
         at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
         at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
      ClientConnectionId:00000000-0000-0000-0000-000000000000
      

      Please advice
      Tamir

      atrippA 1 Reply Last reply Reply Quote 0
      • atrippA Offline
        atripp inedo-engineer @tamir.dahan_7908
        last edited by

        Hi @tamir-dahan_7908,

        The error message coming from ProGet is this:

        Unhandled exception: Microsoft.Data.SqlClient.SqlException (0x80131904): 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: 40 - Could not open a connection to SQL Server)

        So basically it's a network error, and the ProGet container can't talk to the SQL Server container. I'm not an expert on troubleshooting Docker, but my "guess' would be that the network is different between containers.

        This is specified by the net command, and I know I've mistyped that a few times. Here's the script I use to get up and running on Docker:

        docker run --name inedo-sql \
          -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=«YourStrong!Passw0rd»' \
          -e 'MSSQL_PID=Express' --net=inedo --restart=unless-stopped \
          -d mcr.microsoft.com/mssql/server:2019-latest
        
        docker exec -it inedo-sql /opt/mssql-tools/bin/sqlcmd \
          -S localhost -U SA -P '«YourStrong!Passw0rd»' \
          -Q 'CREATE DATABASE [ProGet] COLLATE SQL_Latin1_General_CP1_CI_AS'
        
        docker run -d --name=proget --restart=unless-stopped \
          -v proget-packages:/var/proget/packages -p 80:80 --net=inedo \
          -e PROGET_SQL_CONNECTION_STRING='Data Source=inedo-sql; Initial Catalog=ProGet; User ID=sa; Password=«YourStrong!Passw0rd»' \
          proget.inedo.com/productimages/inedo/proget:latest
        

        Hope that helps,
        Alana

        T 1 Reply Last reply Reply Quote 0
        • T Offline
          tamir.dahan_7908 @atripp
          last edited by atripp

          Thanks Alena
          I tried that you suggested to me to do but it looks like I'm getting the same error message

          ProGet version is 24.0.10.5.
          Current DB schema version is unknown.
          Unhandled exception: Microsoft.Data.SqlClient.SqlException (0x80131904): 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: 40 - Could not open a connection to SQL Server)
             at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
             at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
             at Microsoft.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
             at Microsoft.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
             at Microsoft.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
             at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
             at Microsoft.Data.SqlClient.SqlConnection.Open(SqlConnectionOverrides overrides)
             at Microsoft.Data.SqlClient.SqlConnection.Open()
             at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.GetConnection()
             at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.ExecuteTable[TResult](String query, Func`2 adapter, SqlTransaction transaction, SqlParameter[] args)
             at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.GetChangeScriptVersion(SqlTransaction transaction)
             at Inedo.DbUpdater.SqlServer.SqlServerDatabaseConnection.GetState()
             at Inedo.DbUpdater.ConsoleHost.Update(String scriptPath, String connectionString, Boolean force)
             at Inedo.DbUpdater.ConsoleHost.Run(ArgList args)
             at Inedo.DbUpdater.ConsoleHost.RunAsync(IEnumerable`1 args)
             at Inedo.ProGet.Service.Program.UpdateDatabaseSchemaAsync() in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E463691\Src\ProGet.Service\Program.cs:line 318
             at Inedo.ProGet.Service.Program.Run(WebServerMode mode, Boolean runAsService, Boolean linuxContainer, String urls) in C:\Users\builds\AppData\Local\Temp\InedoAgent\BuildMaster\192.168.44.60\Temp\_E463691\Src\ProGet.Service\Program.cs:line 28
             at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
             at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
          ClientConnectionId:00000000-0000-0000-0000-000000000000
          

          any other suggestion ?
          Tamir

          atrippA 1 Reply Last reply Reply Quote 0
          • atrippA Offline
            atripp inedo-engineer @tamir.dahan_7908
            last edited by

            Hi @tamir-dahan_7908 ,

            Either you're making a typo somewhere, or there is something odd about your Docker/server configuration that is preventing a local network connection. I'm afraid I'm not a Docker expert, so I don't know what else to look for -- it could be specialized security configuration you have or a monitoring tool that's blocking things.

            If you have a Docker expert on your team, I would check with them to get some help. Ultimately, ProGet is just an ordinary .NET application making a connection on an ordinary SQL Server that's on the same local network (i.e. inedo-sql)... it's a super-common use case and just works out of the box.

            The most common issue is a typo (i.e. inedo-sql in one command and inedosql in another), but since this is such a common use case, if you search "Docker" and "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible", you'll find a ton of results with lots of different things to try as well.

            If you're new to Docker, i would suggest installing with Inedo Hub - it's a lot easier to use.

            Cheers,
            Alana

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • 1 / 1
            • First post
              Last post
            Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation