diff --git a/NewLife.Redis/Services/RedisCacheProvider.cs b/NewLife.Redis/Services/RedisCacheProvider.cs
index 0c85771..68b7371 100644
--- a/NewLife.Redis/Services/RedisCacheProvider.cs
+++ b/NewLife.Redis/Services/RedisCacheProvider.cs
@@ -31,7 +31,8 @@ public class RedisCacheProvider : CacheProvider
/// <param name="serviceProvider"></param>
public RedisCacheProvider(IServiceProvider serviceProvider)
{
- var config = serviceProvider.GetRequiredService<IConfigProvider>();
+ var config = serviceProvider?.GetService<IConfigProvider>();
+ config ??= JsonConfigProvider.LoadAppSettings();
if (config != null) Init(config, serviceProvider);
}
#endregion