I am creating an application that allows the user to register and upon registration generates a profile for them on a unique URI. The project started out in 1.1 which stated on the internet i could upgrade to 2 with ease.
This is the code that I am getting an error on
var options = new RewriteOptions() .Add(app.ApplicationServices.GetService<UniqueURLRewriteRule>());
The Error Message
Cannot resolve Middleware.UniqueURLRewriteRule from root provider because it requires scoped service ;/
Error that is Generated:
System.InvalidOperationException
HResult=0x80131509
Message=Cannot resolve 'Ragko.Middleware.UniqueURLRewriteRule' from root provider because it requires scoped service 'Microsoft.AspNetCore.Identity.UserManager`1[Ragko.Models.ApplicationUser]'.
Source=Microsoft.Extensions.DependencyInjection
StackTrace:
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteValidator.ValidateResolution(Type serviceType, ServiceProvider serviceProvider)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Ragko.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in C:\Users\Jason\Documents\Visual Studio 2017\Projects\Ragko\Ragko\Startup.cs:line 89
Seeking
I am not looking for someone to quick solve this for me, I would appreciate if someone could reference a resource I could read to further understand this topic and why it is going wrong? and hopefully solve a solution myself!
Thankyou in advance.