Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sybaris opened this issue Aug 21, 2023 · 0 comments

Comments

@sybaris
Copy link

sybaris commented Aug 21, 2023

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

  • Using VS2022, create a new Console App for .NET 6.0
  • Add the following nuget packages :
    • "Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.10"
    • "Microsoft.EntityFrameworkCore.Tools" Version="7.0.10"
    • "RazorLight" Version="2.3.1"
  • In the package Manager Console, launch the following command : "add-migration CreateDB"
  • Result is : "Build started...
    Build succeeded.
    Hello, World!
    An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: The entry point exited without ever building an IHost.
    To undo this action, use Remove-Migration.
    "

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant