Exploding Hams
Exploding Hams
CC#
Created by kmanjt on 5/13/2024 in #help
Testcontainers CosmosDB / WebApplication Factory ConnectionString Not Working
try specifying the values through the constructor properties so you can rule whether it's straight up formatting giving you trouble:
using CosmosClient client = new(
accountEndpoint: "https://localhost:56685/",
authKeyOrResourceToken: "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
);
using CosmosClient client = new(
accountEndpoint: "https://localhost:56685/",
authKeyOrResourceToken: "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
);
29 replies
CC#
Created by kmanjt on 5/13/2024 in #help
Testcontainers CosmosDB / WebApplication Factory ConnectionString Not Working
otherwise you would need to make an actual connection to a hosted cosmos db instance, or are you running the emulator?
29 replies
CC#
Created by kmanjt on 5/13/2024 in #help
Testcontainers CosmosDB / WebApplication Factory ConnectionString Not Working
Yeah definitely a bum connection string. usually you wouldn't have the IP address like that, it's probably expecting localhost instead (I'll admit I may be a dummy but just a guess), CosmosClient when instantiated will look to make a real connection outwards
29 replies
CC#
Created by kmanjt on 5/13/2024 in #help
Testcontainers CosmosDB / WebApplication Factory ConnectionString Not Working
Alternatively, it could be the connection string formatting from similar exception messages
29 replies
CC#
Created by kmanjt on 5/13/2024 in #help
Testcontainers CosmosDB / WebApplication Factory ConnectionString Not Working
I've used it a bit, but without knowing which line threw the exception in particular, I would caution that when using the web application factory will call the entry point in your Program class. If you have any startup code there, you may need to override any and all initialization you're doing within the builder.ConfigureServices(_ => { }) method.
29 replies