AI OnAI Off
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.
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'.