Cannot access /episerver after upgrade to CMS 12?

Vote:
 

Hi!

So the upgrade from CMS 11 to CMS 12 is now working, finallly. But I cannnot access /episerver, that jus gives me as 404.

Any idea what I'm missing? It looks like every under /modules is there.

public class Program
{
    public static void Main(string[] args)
    {
        var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
        var isDevelopment = environment == Environments.Development;

        if (isDevelopment)
        {
            Log.Logger = new LoggerConfiguration()
                .MinimumLevel.Warning()
                .WriteTo.File("app_data/log.txt", rollingInterval: RollingInterval.Day)
                .CreateLogger();
        }

        CreateHostBuilder(args, isDevelopment).Build().Run();
    }

    public static IHostBuilder CreateHostBuilder(string[] args, bool isDevelopment)
    {
        if (isDevelopment)
        {
            return Host.CreateDefaultBuilder(args)
                .ConfigureAppConfiguration(config =>
                {
                    config.AddJsonFile($"appsettings.{Environment.GetEnvironmentVariable("COMPUTERNAME")}.json", optional: true, reloadOnChange: true);
                })
                .ConfigureCmsDefaults()
                .UseSerilog()
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                });
        }

        return Host.CreateDefaultBuilder(args)
            .ConfigureCmsDefaults()
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseStartup<Startup>();
            });
    }
}
public class Startup
{
    private readonly IWebHostEnvironment _webHostingEnvironment;
    private readonly IConfiguration _configuration;

    public Startup(IWebHostEnvironment webHostingEnvironment, IConfiguration configuration)
    {
        _webHostingEnvironment = webHostingEnvironment;
        _configuration = configuration;
    }

    public void ConfigureServices(IServiceCollection services)
    {
        if (_webHostingEnvironment.IsDevelopment())
        {
            services.Configure<SchedulerOptions>(o =>
            {
                o.Enabled = false;
            });

            services.PostConfigure<DataAccessOptions>(o =>
            {
                o.SetConnectionString(_configuration.GetConnectionString("EPiServerDB").Replace("App_Data", Path.GetFullPath("App_Data")));
            });
            services.PostConfigure<ApplicationOptions>(o =>
            {
                o.ConnectionStringOptions.ConnectionString = _configuration.GetConnectionString("EPiServerDB").Replace("App_Data", Path.GetFullPath("App_Data"));
            });
        }

        services.AddCmsAspNetIdentity<ApplicationUser>();
        services.AddMvc();
        services.AddAlloy();
        services.AddCms();

        services.AddEmbeddedLocalization<Startup>();
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
            app.UseMiddleware<AdministratorRegistrationPageMiddleware>();
        }

        app.UseStaticFiles();
        app.UseRouting();
        app.UseAuthentication();
        app.UseAuthorization();

        app.UseEndpoints(endpoints =>
        {
            endpoints.MapContent();
            endpoints.MapControllerRoute("Register", "/Register", new { controller = "Register", action = "Index" });
            endpoints.MapRazorPages();
        });
    }
}

Thanks!

#270279
Jan 20, 2022 19:12
Vote:
 

Does /util/login or /episerver/cms work? 

#270320
Jan 21, 2022 0:14
Vote:
 

Hi Kristoffer

The default url to CMS 12 backend login is either /util/login or /episerver/cms. There are two endpoints are registered by default to match these two urls. 

You might notice /episerver is working in foundation demo site, because it has Episerver find package installed and the /episerver route is somehow registered in the Episerver.Find package in CMS 12. 

I hope above helps.

#270321
Edited, Jan 21, 2022 5:09
Vote:
 

Now that was embarrassing! Before /episerver always redirected you to the login page but not anymore.

/episerver/cms works just perfect!

Thanks!

/Kristoffer

#270322
Jan 21, 2022 6:31
Vote:
 

If you've formed a habit of just typing "/episerver" into the URL and expecting to get to the login or edit UI (like I have), you could just add a rewrite in your Startup.cs.

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    ...

    var rewriteOptions = new RewriteOptions()
        .AddRedirect("episerver(/)?$", "episerver/cms");
    app.UseRewriter(rewriteOptions);

    ...
}

I'm not sure what implications this will have, but it works for the time being.

#271096
Feb 03, 2022 19:17
Mohamed Morsy - Dec 13, 2022 14:03
Thanks Chris, This solved it for me
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.