Copied to clipboard

Flag this post as spam?

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


  • Yaco Zaragoza 80 posts 334 karma points
    Jul 20, 2023 @ 20:28
    Yaco Zaragoza
    0

    I published my site and now it can't find the database

    Can anyone tell me what file I need to check for resetting the database connection, It seems like I published my site and not I am getting the set up screen

  • Bo Jacobsen 597 posts 2395 karma points
    Jul 21, 2023 @ 07:29
    Bo Jacobsen
    0

    Hi Yaco.

    Do you have a file called appsettings.json or appsettings.Production.json?

    Inside there should be a field to enter your connectionstring like...

    "ConnectionStrings": {
        "umbracoDbDSN": ""
      }
    
  • Yaco Zaragoza 80 posts 334 karma points
    Jul 21, 2023 @ 13:20
    Yaco Zaragoza
    0

    How do I set what environment it will use?

    in my appsettings.json I have

    "CMS": { "Runtime": { "Mode": "Development" },

    and I have a appsettings.Development.json file with the following connection string

      "ConnectionStrings": {
        "umbracoDbDSN": "server=SERVERNAMEHERE;database=DATABASENAMEHERE;user id=USERNAME;password='PASSWORD'",
        "umbracoDbDSN_ProviderName": "Microsoft.Data.SqlClient"
      }
    
  • Bo Jacobsen 597 posts 2395 karma points
    Jul 24, 2023 @ 08:34
    Bo Jacobsen
    0

    There is an environment variable named ASPNETCORE_ENVIRONMENT that you can change. There is a link here where you can read different suggestions. https://stackoverflow.com/questions/41546943/how-to-set-aspnetcore-environment-to-be-considered-for-publishing-an-asp-net-cor

    I use Web.config with transformation on publish.

    Web.config

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <system.webServer>
            <aspNetCore processPath="dotnet" arguments=".\MyProject.Web.dll" hostingModel="InProcess" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout">
                <environmentVariables>
                    <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
                </environmentVariables>
            </aspNetCore>
        </system.webServer>
    </configuration>
    

    Web.Release.config

    <?xml version="1.0"?>
    <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
        <system.webServer>
            <aspNetCore>
                <environmentVariables xdt:Transform="InsertIfMissing">
                    <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Production" xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
                </environmentVariables>
            </aspNetCore>
        </system.webServer>
    </configuration>
    

    and then it would use the appsettings.Production.json.

  • Yaco Zaragoza 80 posts 334 karma points
    Aug 02, 2023 @ 18:16
    Yaco Zaragoza
    0

    I check the appsettings.json and appsettings.{Enviroment}.json and the database information seems to be correct. but when I go to the domain I am seeing

    enter image description here

    can anyone help me?

  • Bo Jacobsen 597 posts 2395 karma points
    Aug 03, 2023 @ 07:29
    Bo Jacobsen
    0

    Do you use the same database when you deploy?

    If not, is the database you then use maybe empty?

  • Yaco Zaragoza 80 posts 334 karma points
    Aug 03, 2023 @ 14:11
    Yaco Zaragoza
    0

    I cloned the database and its the same on both servers (Dev and Live)

Please Sign in or register to post replies

Write your reply to:

Draft