I have started in the last few weeks working (or trying it) Simple MVC-App for notifications.
I used this example and established iP-tunnels ot localhost with ngrok.(see sample & content page below). https://learn.microsoft.com/de-de/learn/modules/msgraph-changenotifications-trackchanges/5-exercise-change-notification
https://github.com/microsoftgraph/msgraph-training-changenotifications/tree/live
If I run only on app locally at same time all is fine but if I will start a 2nd Notification App it failed with this message
System.IO.IOException: Failed to bind to address https://127.0.0.1:5001: address already in use. ---> Microsoft.AspNetCore.Connections.AddressInUseException: Normalerweise darf jede Socketadresse (Protokoll, Netzwerkadresse oder Anschluss) nur jeweils einmal verwendet werden.
I tried some changes in ngrok.yml file but without access too.
# Create 3 tunnels, each for different ports, with only https enabled
# This way the ngrok process stays bellow the Free plan limit (4 tunnels)
authtoken: **************************
log: ngrok.log
tunnels:
first:
addr: 5000
proto: http
#host_header: localhost
second:
addr: 5000
proto: http
#host_header: localhost
I tried to change the url in the appsetting.json but it doesn't work:
{
"Logging": {
"LogLevel": {
"Default": "Debug"
}
},
"AllowedHosts":"*",
"MyConfig": {
"AppId": "****************",
"AppSecret": "*********************",
"TenantId": "********",
"Ngrok": "https://76bd76a6aca4.ngrok.io"
}
}
But after starting the first app the 2nd crashed on exceptions. Then I tried to use ports 5000 m 5010 and so on and changed the settings in launchsetting.json but I failed again.
"msgraphapp": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
Please can someone tell me what I must do, so that I can start 2 or more apps running on localhost and tunneled with ngrok or an alternative.
You must have followed Exercise - Azure AD apps .NET core web APIs. To have tow apps running and exposing two Ngrok tunnels for graph change notifications
First configure your ~/.ngrok2/ngrok.yml like below. Notice the different ports.
Second edit each of your apps properties to have different set of http and https bind ports. See the screenshot below showing settings on launchSettings.json for each file.
This way you should be able to run two .net apps with each having Ngrok tunnel for MS graph.
Remember to have the right Ngrok url added to each appSettings