Errors when trying to install Geta.NotFoundHandler.Optimizely

Vote:
 

I installed the NuGet 

 Install-Package Geta.NotFoundHandler.Optimizely

 and added the following 

 services.AddHttpContextAccessor();

            services.AddOptimizelyNotFoundHandler(o =>
            {
                o.AutomaticRedirectsEnabled = true;
            });

            services.Configure<TinyMceConfiguration>(config =>
            {
                config.Default()
                      .AddEpiserverSupport()
                      .AddPlugin("epi-link code")
                      .AppendToolbar("epi-link | code");
            });


          

But I get this error when I start the application:

An unhandled exception of type 'System.InvalidOperationException' occurred in System.Private.CoreLib.dll
Unable to resolve service for type 'Geta.NotFoundHandler.Core.Redirects.IRedirectsService' while attempting to activate 'Geta.NotFoundHandler.Optimizely.Core.AutomaticRedirects.DefaultAutomaticRedirectsService'.

#297166
Feb 24, 2023 20:12
Vote:
 

Use the following code in ConfigureServices

 services.AddNotFoundHandler(o =>
        {
            o.UseSqlServer(Configuration.GetConnectionString("EPiServerDB"));
        });
        services.AddOptimizelyNotFoundHandler(o =>
        {
            o.AutomaticRedirectsEnabled = true;
        });

And after that use the following code in Configure method

        app.UseNotFoundHandler();
        app.UseOptimizelyNotFoundHandler();
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }

And use this in the endpoints 

app.UseEndpoints(endpoints =>
        {
            endpoints.MapRazorPages();
            endpoints.MapContent();
        });

And please follow the official documentation for this package.  


#297325
Feb 27, 2023 13:54
* 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.