Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • kyle 49 posts 240 karma points
    Sep 02, 2022 @ 08:35
    kyle
    0

    Umbraco could not connect to the database.

    Hey devs, I really need help with this.

    I have a Umbraco website built on my local dev machine, everything is 100% the site boots up properly and I'm able to navigate and interact with it, all good and 100%.

    So I'm busy loading the site on our server and I've done this multiple times already with 3 different Umbraco sites and everything went smoothly.

    But in this instance, I get this error

    Boot failed: Umbraco cannot run. See Umbraco's log file for more details.
    
    -> Umbraco.Core.Exceptions.BootFailedException: A connection string is configured but Umbraco could not connect to the database.
      at Umbraco.Core.RuntimeState.DetermineRuntimeLevel(IUmbracoDatabaseFactory databaseFactory) in D:\a\1\s\src\Umbraco.Core\RuntimeState.cs:line 188
      at Umbraco.Core.Runtime.CoreRuntime.DetermineRuntimeLevel(IUmbracoDatabaseFactory databaseFactory, IProfilingLogger profilingLogger) in D:\a\1\s\src\Umbraco.Core\Runtime\CoreRuntime.cs:line 498
      at Umbraco.Core.Runtime.CoreRuntime.Boot(IRegister register, DisposableTimer timer) in D:\a\1\s\src\Umbraco.Core\Runtime\CoreRuntime.cs:line 186
    

    this is my local sting in config file:

    <add name="umbracoDbDSN" connectionString="Server=DESKTOP-*****\KYLE;Database=DBname;Integrated Security=true" providerName="System.Data.SqlClient" />
    

    and this is the string on the server:

     <add name="umbracoDbDSN" connectionString="Server=**.*.**.**\SQLEXPRESS;Database=DBnam;user id=******;password=*******" providerName="System.Data.SqlClient" />
    

    I know that the issue is most likely my conn string but I just don't know why.

  • Lucas Bisgaard 19 posts 128 karma points c-trib
    Sep 02, 2022 @ 08:47
    Lucas Bisgaard
    0

    Hey Kyle,

    Have you tried to connect to the database with the Sql server management studio? It´s likely either permission to the user or credintials witchs is not matching, but the Sql server management will tell you :)

  • kyle 49 posts 240 karma points
    Sep 02, 2022 @ 09:33
    kyle
    0

    HI there, that's the thing... I can log in perfectly with the details specified in the conn string...

  • Lucas Bisgaard 19 posts 128 karma points c-trib
    Sep 02, 2022 @ 09:58
    Lucas Bisgaard
    0

    Can you make any SQL statements into a table as

    SELECT TOP (1000) * FROM [dbo].[umbracoNode]
    
  • kyle 49 posts 240 karma points
    Sep 02, 2022 @ 10:02
    kyle
    0

    Hey Lucas,

    I've just tested it and yes I can run the statement successfully I've really exhausted all my options my mind is baffled :/

  • kyle 49 posts 240 karma points
    Sep 02, 2022 @ 10:06
    kyle
    0

    with the previous sites that I've done the conn string points to the Umbraco.sdf file in the app_data, but I guess that's not possible in this case since all the Umbraco content is in the DB and there is no .sdf file in the solution.

  • Lucas Bisgaard 19 posts 128 karma points c-trib
    Sep 02, 2022 @ 10:12
    Lucas Bisgaard
    1

    Okay, we know is not the connectionstring or permission, let´s try something out of the boks.

    I hope you have access to the server, because we gonna test the connectionString and connect to the SQL Database thouge PowerShell!

    On the server open the newest version of Powershell in administrator mode.

    And starter the first line:

    $conn = New-Object System.Data.SqlClient.SqlConnection    
    

    For the next line type in

    $conn.ConnectionString = "replace with connection from config"        
    

    For the last type in

    $conn.Open()
    

    Either it stalls and you get and exception in powershell of the issue, and there is some network issue, that the server can not talk to the Database else is just allow you to type more commands, and evertything is fine.

  • kyle 49 posts 240 karma points
    Sep 02, 2022 @ 13:12
    kyle
    0

    wow, I never knew that I can do this, this will really help in the future for testing connections thanks.

    I did get an exception...

    Exception calling "Open" with "0" argument(s): "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: SQL Network Interfaces, 
    error: 26 - Error Locating Server/Instance Specified)"
    At line:1 char:1
    + $conn.Open()
    + ~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : SqlException
    

    This is the string...

    $conn.ConnectionString = "Server=serverIp\SQLEXPRESS;Initial Catalog=DBname;user id=****;password=****"
    

    So I know 100% that the user details are working and there are no permission issues, so with that said the only issue can be in the

    Server=serverIp\SQLEXPRESS;
    

    portion, but what is it?

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Sep 02, 2022 @ 15:59
    Huw Reddick
    0

    Is the server the same machine as wesite? If yes, just try .\SQLEXPRESS

  • kyle 49 posts 240 karma points
    Sep 05, 2022 @ 07:39
    kyle
    0

    Hi there, yes it is on the same machine. I have tried your suggestion but I'm getting a new error...

    Access to the path 'E:\websites\website_name\App_Data\TEMP\NuCache\NuCache.Content.db' is denied.]
    

    I have given the Network service full control of the 'App data' folder

  • kyle 49 posts 240 karma points
    Sep 05, 2022 @ 08:06
    kyle
    101

    Hi, I have found the solution...

    It was not the connection string at all. I had to give the following object full control to the 'App data' folder, IIS_IUSRS\servername. This resolved the issue, the site is up.

    I have never manually done this before. It's strange that it was not automatically added I wish I knew why? But it works, hope this helps someone in the future, thanks for all the input

Please Sign in or register to post replies

Write your reply to:

Draft