AspNetCoreRateLimit
AspNetCoreRateLimit copied to clipboard
Update to Version 4.0.1
Dear All ,
i have updated my project using Ratelimit from 3.2.2 to 4.0.1 and i received error "'Unable to resolve service for type 'AspNetCoreRateLimit.IProcessingStrategy' while attempting to activate 'AspNetCoreRateLimit.IpRateLimitMiddleware" , may i have an answer that what has been changed or added to 4.0.1 to made this error happen? shall i register a new services ?
https://github.com/stefanprodan/AspNetCoreRateLimit/releases/tag/4.0.0 https://github.com/stefanprodan/AspNetCoreRateLimit/issues/216
Is there any workable example with version 4? Without the proper docs all the release becomes useless because running it together with Redis is quite complicated.
unfortunately , I am also could not find a useful data from the link which cristi sent , I still had to use the previous version and did not be able to upgrade myself to the newest version .
br
C'mon, it's really not that hard ...
https://github.com/stefanprodan/AspNetCoreRateLimit/blob/master/test/AspNetCoreRateLimit.Demo/Startup.cs#L35 https://github.com/stefanprodan/AspNetCoreRateLimit/wiki/Using-Redis-as-a-distributed-counter-store
@cristipufu I am really curious why in Demo app services.AddMemoryCache();
is not necessary? In my aspnet core 5 project I had to add it to make it work with simple InMemoryRateLimiting. Also in wiki docs it is added...
https://docs.microsoft.com/en-us/aspnet/core/performance/caching/memory?view=aspnetcore-5.0
For most apps, IMemoryCache is enabled. For example, calling AddMvc, AddControllersWithViews, AddRazorPages, AddMvcCore().AddRazorViewEngine, and many other Add{Service} methods in ConfigureServices, enables IMemoryCache. For apps that are not calling one of the preceding Add{Service} methods, it may be necessary to call AddMemoryCache in ConfigureServices.
To solve this particular problem I just added the configuration of the RedisCache through the AddStackExchangeRedisCache() method before adding its IConnectionMultiplexer . But I keep receiving some other error that I couldn't figure how to solve at all.
something like this:
services.AddStackExchangeRedisCache(options =>
{
options.ConfigurationOptions = new ConfigurationOptions
{
//silently retry in the background if the Redis connection is temporarily down
AbortOnConnectFail = false
};
options.Configuration = configuration.GetConnectionString("Redis");
options.InstanceName = "HubRateLimit";
});
https://github.com/stefanprodan/AspNetCoreRateLimit/issues/261