Azure/azure-functions-core-tools

Visual Studio template port confusion

Offen

#3.237 geöffnet am 05.01.2023

 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)C# (491 Forks)auto 404
area: templatesdocumentationgood first issue

Repository-Metriken

Stars
 (1.456 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

In Visual Studio 2022 creating a new Azure Function (Event Grid function in my case) the template for Function1 states port 7071:

// Default URL for triggering event grid function in the local environment.
// http://localhost:7071/runtime/webhooks/EventGrid?functionName={functionname}
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.EventGrid;
using Microsoft.Extensions.Logging;
using Azure.Messaging.EventGrid;

namespace FunctionApp4
{
    public static class Function1
    {
        [FunctionName("Function1")]
        public static void Run([EventGridTrigger]EventGridEvent eventGridEvent, ILogger log)
        {
            log.LogInformation(eventGridEvent.Data.ToString());
        }
    }
}

But the actual port number is 7166 and randomly set when template is created and configured in launchsettings.json

{
  "profiles": {
    "FunctionApp4": {
      "commandName": "Project",
      "commandLineArgs": "--port 7166",
      "launchBrowser": false
    }
  }
}

Contributor Guide