John Liu Blog

Every drop counts

Azure Cosmos DB Emulator

We can use Azure CosmosDB emulator to simulate Azure CosmosDB without actually connect to Azure environment. The emulator is running inside a container. To setup the container using the latest image: docker run -it --name cosmosDB -p 8081:8081 mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator This will create a container named cosmosDB and the emulator access port is 8081. When .Net code connect to the emulator, you might receive error about “The SSL connection could not be established” and “The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot”.

HttpWebRequest SSL/TLS error

If you are using HttpWebRequest in your application, you may receive “The request was aborted: Could not create SSL/TLS secure channel” error. This error might be caused by the mismatch SSL/TLS protocol between the server and client. The solution is to make sure that both client and server have a common protocol version supported. Add following line in your code to let the client be able to connect to as many servers as possible (rather than to be as secure as possible).