CosmosDB emulator can't start since port is already in use

坚强是说给别人听的谎言 提交于 2019-12-22 04:04:22

问题


I'm giving CosmosDB a chance and so I decided to build an app that uses it, but I'm running into this issue when using the emulator: Port is already in use.

I'm not sure where to reconfigure the port the emulator is pointing.


回答1:


You can use /Port option to configure the emulator to listen to a different port.

https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator#a-idcommand-lineacommand-line-tool-reference




回答2:


I had a similar problem, where i got an error "port 10253 already in use" which is a port for Direct connectivity. Direct connectivity port defaults for CosmosDB are 10251,10252,10253,10254.

Used the following Command-line Syntax to change the default port and it worked,

CosmosDB.Emulator.exe /DirectPorts=10261,10262,10263,10264


OR (in my case)


"C:\Program Files\Azure Cosmos DB Emulator\CosmosDB.Emulator.exe" /DirectPorts=10261,10262,10263,10264

Note: You can use port of your choice, but make sure that they are not already in use




回答3:


I finally got it working with powershell.

Import module

$env:PSModulesPath += "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules"
Import-Module Microsoft.Azure.CosmosDB.Emulator

Stop CosmosDB emulator

Stop-CosmosDbEmulator

Start CosmosDB emulator with prefered port

Start-CosmosDbEmulator  -Port 10101

And I got it working... Hope this helps.



来源:https://stackoverflow.com/questions/44851311/cosmosdb-emulator-cant-start-since-port-is-already-in-use

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!