Copied to clipboard

Flag this post as spam?

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


  • Carlos Mosqueda 240 posts 431 karma points
    Nov 12, 2021 @ 20:13
    Carlos Mosqueda
    0

    Umbraco 9 Connection string issue from rebuilt solution, making me go back to install, Why?

    I have a publishable site in which I set up to run on my locall IIS.
    I have a DB on my local computer and pointed to in the applicationSettings.json file. I have my local host file pointed to the application. I originally built it with a local DB file in the Umbraco file system. I recreated the DB and scripted the DB to have the same Schema and Data from the MDF file that was in the file system.

    BUT, when I run the Umbraco 9 site, it keeps redirecting me to the Install page. I am totally confused why this would be happening.
    Does anyone have any tis or ideas?

    My connection string from my appsettings is below:

    "ConnectionStrings": {
     "umbracoDbDSN": "Data Source=MyMachineName;Database=DOI_DB;User Id=DOI_DB_Admin2;Password=MyPassword;"
    
  • Andrew 52 posts 234 karma points
    Nov 12, 2021 @ 20:21
    Andrew
    0

    Do you have another appsettings file (eg appsettings.Development.json) that might be overriding the conn string?

  • Heather Floyd 603 posts 1001 karma points MVP 5x c-trib
    Feb 08, 2022 @ 18:45
    Heather Floyd
    0

    I am having a somewhat similar issue - I wanted to set up a new Umbraco9 demo site locally. First I followed the directions to use the command line to set up the initial project (https://our.umbraco.com/documentation/Fundamentals/Setup/Install/install-umbraco-with-templates) and from inside VS I built and ran - it popped up a browser pointing to "http://localhost:9534" I successfully ran through the installation wizard, Customizing the DB to "LocalDB". It loaded the back-office after install without issue.

    For previous Umbraco versions development, I like to use project-specific domain names (added to the HOSTS file) and run via IIS, so I followed the directions to "Learn how to run an already installed local installation of Umbraco 9" (https://our.umbraco.com/documentation/Fundamentals/Setup/Install/iis). I was able to get it set up, and could click the "run" button from inside Visual Studio, and it opened a browser with my custom url (http://umbraco9demo.local) - but it shows me the installation wizard again. I tried to go directly to http://umbraco9demo.local/umbraco, but it keeps redirecting to the installer.

    I only have a single appsettings.json file in the project which includes this:

    "ConnectionStrings": {
        "umbracoDbDSN": "Data Source=(localdb)\\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\\Umbraco.mdf;Integrated Security=True"
      },
    

    I can't figure out why the IIS version doesn't see that the DB is set up...

  • Andrew 52 posts 234 karma points
    Feb 08, 2022 @ 19:14
    Andrew
    1

    If you put a breakpoint in Startup:Startup, you can verify that the connection string being used is the one you expect.

        public Startup(IWebHostEnvironment webHostEnvironment, IConfiguration config)
        {
            var connString = config.GetConnectionString("umbracoDbDSN");
            _env = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment));
            _config = config ?? throw new ArgumentNullException(nameof(config));
        }
    
  • Heather Floyd 603 posts 1001 karma points MVP 5x c-trib
    Feb 08, 2022 @ 21:40
    Heather Floyd
    0

    Thanks for that tip, Andrew. Since it was a fresh project, I ended up just deleting the directory and starting over. The new problem I was having related to LocalDB being unavailable (sigh...) So I just set up a SQL 2019 db, and managed to get it working.

  • Carlos Mosqueda 240 posts 431 karma points
    Mar 07, 2022 @ 22:54
    Carlos Mosqueda
    100

    @Heather,

    Yes, the localDB is kind of annoying. Your best bet is to just create a new SQL DB instead of using the localDB. I just exported the localDB since I had some data already in it and didn't want to recreated it. I was able to open it in SQL Server Manager and just exported the data and schema and edited that file for my import into a full SQL DB. Otherwise you just start over from scratch.
    It seems that the local DB, if the SQL Service is not allowed to see your machine, Umbraco will not see the DB. I had to go into do some Windows Services and allow some settings on the SQL Service manager to see my machine.
    My suggestion to anyone would just forgo the Local DB and just do a full SQL DB.
    If @UmbracoHQ has any suggestions on getting it to work better, it would be super helpful.

    Warren Buckley has a good tutorial on YouTube on setting up Umbraco 9 on IIS if anyone is interested. He uses a SQL DB instead of local.

Please Sign in or register to post replies

Write your reply to:

Draft