Azure FunctionApp - Only one usage of each socket address (protocol/network address/port) is normally permitted.

Szymon 25 Reputation points
2023-02-01T09:13:44.9666667+00:00

Hello, im receiving error:

2023-02-01T09:05:53.248 [Error] Executed 'myFunctionName' (Failed, Id=df08ed2f-fa3d-4d75-a50c-6d108707bce2, Duration=1042ms)Only one usage of each socket address (protocol/network address/port) is normally permitted.

Following answers from search engine this means port exhaustion, but there are following problems in my case:

  • it was working fine up to today morning;
  • traffic is very low, in example i run this function once, then second time, then third and i get error;
  • i do not open ANY http connections inside.

Whole function body below (removed namespaces from snippet as these are business classes which names i do not want to share):

using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;

namespace DummyPublishers
{
    [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
    public static class DummyStandardRolePublisher
    {
        [FunctionName("DummyPublisher")]
        public static async Task
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,249 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 68,471 Reputation points
    2023-02-09T08:55:24.19+00:00

    @Szymon Thanks for the details. As you are not using cosmos DB input/output binding and using Cosmos DB client library then you need to leverage the lazy pattern as documented here. Please refer to manage connection document and for cosmos DB client

    1 person found this answer helpful.
    0 comments No comments