umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.42k stars 2.67k forks source link

All urls return 404 page after upgrade to 10.1.0 when runtime mode set to Production #12792

Closed teeto closed 2 years ago

teeto commented 2 years ago

Which exact Umbraco version are you using? For example: 9.0.1 - don't just write v9

10.1.0

Bug summary

All urls return 404 page after upgrade to 10.1.0 when runtime mode is set to: "Runtime": { "Mode": "Production" }

if i comment these lines from the appsettings it works ok.

Specifics

No response

Steps to reproduce

Upgrade from 10.0.1 to 10.1.0 Set runtime mode to production.

Expected result / actual result

No response

github-actions[bot] commented 2 years ago

Hi there @teeto!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

nul800sebastiaan commented 2 years ago

I can reproduce. Updated appSettings.json to the following:

{
  "$schema": "./appsettings-schema.json",
  "Serilog": {
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Microsoft": "Warning",
        "Microsoft.Hosting.Lifetime": "Information",
        "System": "Warning"
      }
    }
  },
  "Umbraco": {
    "CMS": {
      "Runtime": {
        "Mode": "Production"
      },
      "Global": {
        "Id": "a770bdfc-0fe8-45df-941b-dda79686d7da",
        "SanitizeTinyMce": true,
        "UseHttps": true
      },
      "ModelsBuilder": {
        "ModelsMode": "Nothing"
      },
      "Content": {
        "ContentVersionCleanupPolicy": {
          "EnableCleanup": true
        }
      },
      "WebRouting": {
        "UmbracoApplicationUrl": "https://localhost:5001/"
      }
    }
  },
  "ConnectionStrings": {
    "umbracoDbDSN": "Data Source=(localdb)\\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\\Umbraco.mdf;Integrated Security=True",
    "umbracoDbDSN_ProviderName": "Microsoft.Data.SqlClient"
  }
}

Then did a publish: dotnet publish -c Release -o .\publish. In the publish directory ran the MyProject.exe and went to https://localhost:5001/ where I ran the installer and then the starter kit installer kicked in (used the https://www.nuget.org/packages/clean starter kit). All of the URLs present with "Page not found".

image

ronaldbarendse commented 2 years ago

Hi @teeto, you probably still have the RazorCompileOnBuild and RazorCompileOnPublish properties in your project file set to false... Because Production runtime mode disables Razor runtime compilation, views are only available when they're compiled on build/publish, hence the need to remove these properties (or explicitly set them to true - the default value). If you don't, Umbraco returns a 404 because it can't find the template.

The documentation mentions this:

I've created a PR to update the documentation to make this more explicit: https://github.com/umbraco/UmbracoDocs/pull/4269.

Let me know if this fixes the issue for you and whether adding this note might have avoided the confusion! I also recommend watching the Unboxing Umbraco 10.1 video, as I've included this gotcha in the demo 😄

teeto commented 2 years ago

Thanks @ronaldbarendse i have made those changes and now it works! I did not read the docs throughly enough and i understood the contrary, that they had to be false :)

ronaldbarendse commented 2 years ago

Great to hear @teeto! I'll close this issue as it's fixed and we'll have this more clearly documented 📖💪🏻