Reputation: 1464
I am trying to add an initial migration in my aspire project.
I am using Aspire.Pomelo.EntityFrameworkCore.MySql
Below is my code for microservice and apphost.
AppHost
var builder = DistributedApplication.CreateBuilder(args);
//var mysqlPassword = builder.AddParameter("sql-password", secret: true);
var mysqlDbContainer = builder.AddMySql("mysql-db-container").WithDataVolume();
var identityDbCatalog = mysqlDbContainer.AddDatabase("identitydb");
builder.AddProject<Projects.SchoolFee_IdentityService>("identityservice").WithReference(identityDbCatalog);
builder.Build().Run();
MicroService
var builder = WebApplication.CreateBuilder(args);
builder.AddMySqlDbContext<IdentityServiceDbContext>("identitydb");
builder.AddServiceDefaults();
...
When I run dotnet ef migrations add Initial
in my microservice, I get below error
Execution attempt. Source: 'Microsoft.Extensions.Hosting.AspireEFMySqlExtensions.ServerVersion/(null)/Retry', Operation Key: '', Result: 'Access denied for user ''@'172.17.0.1' (using password: NO)', Handled: 'False', Attempt: '0', Execution Time: 209.9911ms
MySqlConnector.MySqlException (0x80004005): Access denied for user ''@'172.17.0.1' (using password: NO)
However, connectionstring is working fine if i try to debug.
How can I create migrations so that it can be applied during deployments?
Upvotes: 1
Views: 299