I have the following code
private readonly MsSqlTestcontainer _msSqlTestcontainer;
public DbSessionConnectionFactory()
{
_msSqlTestcontainer = new TestcontainersBuilder<MsSqlTestcontainer>()
.WithImage("mcr.microsoft.com/mssql/server:2022-latest")
.WithPortBinding(1433, 1433)
.WithEnvironment("ACCEPT_EULA", "Y")
.WithEnvironment("SA_PASSWORD", "Admin_12345")
.Build();
}
public async Task InitializeAsync()
{
await _msSqlTestcontainer.StartAsync();
}
A few days ago the StartAsync
method was working without any error.
But now when I run the code I get the following exception:
Port '_msSqlTestcontainer.Port' threw an exception of type 'System.InvalidOperationException' int {System.InvalidOperationException}
What should I do?