我在过去几周开始工作(或尝试)Simple MVC-App 以获取通知。
我使用了这个示例并使用 ngrok 建立了 iP-tunnels ot localhost。(请参阅下面的示例和内容页面)。 https://docs.microsoft.com/de-de/learn/modules/msgraph-changenotifications-trackchanges/5-exercise-change-notification
https://github.com/microsoftgraph/msgraph-training-changenotifications/tree/live
如果我同时只在本地应用程序上运行一切都很好,但如果我将启动第二个通知应用程序,它会失败并显示此消息
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.
我在 ngrok.yml 文件中尝试了一些更改,但也无法访问。
# 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
我试图更改 appsetting.json 中的 url,但它不起作用:
{
"Logging": {
"LogLevel": {
"Default": "Debug"
}
},
"AllowedHosts":"*",
"MyConfig": {
"AppId": "****************",
"AppSecret": "*********************",
"TenantId": "********",
"Ngrok": "https://76bd76a6aca4.ngrok.io"
}
}
但是在启动第一个应用程序后,第二个应用程序因异常而崩溃。然后我尝试使用端口 5000 m 5010 等等,并更改了 launchsetting.json 中的设置,但我又失败了。
"msgraphapp": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
请有人告诉我我必须做什么,以便我可以启动 2 个或更多在 localhost 上运行的应用程序,并使用 ngrok 或替代方案进行隧道传输。