Geta / geta-notfoundhandler

The popular NotFound handler for ASP.NET Core and Optimizely, enabling better control over your 404 page in addition to allowing redirects for old URLs that no longer works.
Apache License 2.0
19 stars 16 forks source link

NullNotFoundHandlerProvider doesn't exist #114

Closed djb-frog closed 6 months ago

djb-frog commented 6 months ago

The readme example config includes the line o.AddProvider\<NullNotFoundHandlerProvider>();

But NullNotFoundHandlerProvider doesn't exist in the package or my solution. Is this just a placeholder for adding a custom provider or do I need a default provider in here? The reason I ask is because I'm getting the error System.IndexOutOfRangeException: 'Cannot find table 0.' - it appears the database table isn't being created. Am I missing an SQL provider possibly?

        services.AddNotFoundHandler(o =>
            {
                o.UseSqlServer(connectionString);
                o.HandlerMode = FileNotFoundMode.On;
                o.IgnoredResourceExtensions = new[]
                    { "jpg", "gif", "png", "css", "js", "ico", "swf", "woff", "eot", "otf" };
                o.Logging = LoggerMode.Off;
                o.LogWithHostname = false;
                // o.AddProvider<NullNotFoundHandlerProvider>();
            },
            policy => { policy.RequireRole(RoleConstants.VirtualRoles.CmsAdmins); });

        services.AddOptimizelyNotFoundHandler(opts => { opts.AutomaticRedirectsEnabled = true; });
djb-frog commented 6 months ago

OK I think I had previously set this up wrongly and I somehow ended up with a database with the stored procedures but without the tables. After I deleted the stored procedures this was resolved.