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

Help needed: Correct way to use FlareSolverrSharp with .net 6/7 dependency injection #24

Open
TheBinaryLoop opened this issue Sep 18, 2023 · 1 comment

Comments

@TheBinaryLoop
Copy link

Hi,

I'm currently trying to use FlareSolverrSharp in one of my applications. Microsoft recommends to use a IHttpClientFactory for dependency injection. This library doesn't seem compatible with that. I always get this error:
System.InvalidOperationException: The 'InnerHandler' property must be null. 'DelegatingHandler' instances provided to 'HttpMessageHandlerBuilder' must not be reused or cached. Handler: 'FlareSolverrSharp.ClearanceHandler'

Is it possible to use it like I'm currently trying to do?

@asulwer
Copy link

asulwer commented May 7, 2024

in ConfigureServices, this is what i added

services.AddHttpClient(System.Reflection.Assembly.GetEntryAssembly().FullName, client => { client.Timeout = TimeSpan.FromSeconds(500); //500 second timeout error, occassionally occurs }).ConfigurePrimaryHttpMessageHandler(builder => new ClearanceHandler("http://localhost:8191/") { MaxTimeout = 2 * (60 * 1000) //2 minutes });

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

2 participants