jamesmh / coravel

Near-zero config .NET library that makes advanced application features like Task Scheduling, Caching, Queuing, Event Broadcasting, and more a breeze!
https://docs.coravel.net/Installation/
MIT License
3.66k stars 242 forks source link

No service for type X has been registered.' #123

Closed bpollardFlow closed 4 years ago

bpollardFlow commented 4 years ago

Describe the bug I am creating a new .NET Core project from scratch to use Coravel Pro. I have attempted this in both .NET Core 3 and 2.2 with the same result. Whenever I hit app.UseCoravelPro(); i get

No service for type 'HoloNetCommand.FlowAutoDotComContext' has been registered.'

I really want to use this tool, but I cannot get past this. Can you help?

jamesmh commented 4 years ago

Sure! What does your Startup.cs method ConfigureServices look like?

bpollardFlow commented 4 years ago
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        else
        {
            app.UseExceptionHandler("/Home/Error");
            app.UseHsts();
        }

        app.UseHttpsRedirection();
        app.UseStaticFiles();
        app.UseCookiePolicy();
        app.UseCoravelPro();
        app.UseMvc(routes =>
        {
            routes.MapRoute(
                name: "default",
                template: "{controller=Home}/{action=Index}/{id?}");
        });
bpollardFlow commented 4 years ago
        services.Configure<CookiePolicyOptions>(options =>
        {
            // This lambda determines whether user consent for non-essential cookies is needed for a given request.
            options.CheckConsentNeeded = context => true;
            options.MinimumSameSitePolicy = SameSiteMode.None;
        });
        services.AddCoravelPro(typeof(FlowAutoDotComContext));

        services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
bpollardFlow commented 4 years ago

I figured it out. I was missing a good bit of stuff in my startup and program classes.

bpollardFlow commented 4 years ago

Thanks!

jamesmh commented 4 years ago

Great! Let me know if you have any more questions or issues. Coravel Pro has its own repo if you need to create some future issues 👍

https://github.com/jamesmh/coravelpro