-
Notifications
You must be signed in to change notification settings - Fork 16
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
Connection failing in startup.cs #12
Comments
Have you seen the sample code in this Repo for connecting with Service principal? What error you are getting? https://github.com/Azure/Microsoft.Azure.StackExchangeRedis/blob/main/sample/Sample.cs#L66 |
Hello, could you update with the error and where you're running the startup.cs? Connecting with AAD is only supported on Azure VMs for now. |
Hey, we are trying to connect our Reddis cache to an Azure App service. Is that possible? |
It seems this library does not work together with ASP.NET Core's Please show a sample using ASP.NET Core Web App. |
The extension built out of this repo is only for the |
@sven5 - we were able to get csproj: <PackageReference Include="Microsoft.Azure.StackExchangeRedis" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.7" /> Extension method:
public static class CachingExtensions
{
public static async Task<IServiceCollection> AddCaching(this IServiceCollection services, IConfiguration configuration)
{
services.Configure<CachingOptions>(configuration.GetSection(CachingOptions.Position));
var settings = configuration.GetSection(CachingOptions.Position).Get<CachingOptions>();
var configurationOptions = ConfigurationOptions.Parse(settings.RedisConnectionString);
await configurationOptions.ConfigureForAzureWithTokenCredentialAsync(new DefaultAzureCredential());
configurationOptions.DefaultDatabase = settings.RedisDefaultDatabase;
services.AddStackExchangeRedisCache(options =>
{
options.ConfigurationOptions = configurationOptions;
});
return services;
}
} Program.cs (minimal): var builder = WebApplication.CreateBuilder(args);
await builder.Services.AddCaching(builder.Configuration); |
Hi,
I am trying the following code in my startup.cs to make the connection for redis cache but it isn't working for me.
Can someone provide a sample for this or managed identity in startup.cs
The text was updated successfully, but these errors were encountered: