Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Cannot Resolve Middleware.UniqueURLRewriteRule Requires Scoped Service

$
0
0
<div class="post_body"> <div class="post entry-content">Background Of Issue
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
<div id="highlighter_962293" class="syntaxhighlighter "> <div class="lines"> <div class="line alt1">
1var options = new RewriteOptions()
</div> <div class="line alt2">
2        .Add(app.ApplicationServices.GetService<UniqueURLRewriteRule>());
</div> </div> </div>


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. </div> </div> <div class="rep_bar clear right" id="rep_post_2351083">Is This A Good Question/Topic?0</div>

Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>