toddams / RazorLight

Template engine based on Microsoft's Razor parsing engine for .NET Core
Apache License 2.0
1.5k stars 259 forks source link

Entity Framework Core and RazorLight : "An error occurred while accessing the Microsoft.Extensions.Hosting service" #531

Open sybaris opened 10 months ago

sybaris commented 10 months ago

Describe the bug When you add RazorLight to your Console App that use EF Core, operation like add-migration or update-database raise this error/warning : "An error occurred while accessing the Microsoft.Extensions.Hosting services"

To Reproduce

Expected behavior Same result but without the message "An error occurred while accessing the Microsoft.Extensions.Hosting services..."

Information (please complete the following information): Note that I have on another project the following message : An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure' to the 'UseSqlServer' call.