Home > Mobile >  Azure Time trigger function - Getting error- No connection could be made because the target machine
Azure Time trigger function - Getting error- No connection could be made because the target machine

Time:01-17

enter image description here

My Azure Time trigger function

public async Task Run([TimerTrigger("0 */5 * * * *")] TimerInfo myTimer, ILogger log)
        {
            try
            {
                log.LogInformation("C# HTTP trigger function processed a request.");

        }
}
  1. I have clean %Temp% and Temp folder.
  2. Restarted my machine.
  3. StorageEmulator is runnig
  4. I have Change port in
    "StorageEmulatorConfig"

From

<StorageEmulatorConfig>
    <services>
      <service name="Blob" url="http://127.0.0.1:10000/"/>
      <service name="Queue" url="http://127.0.0.1:10001/"/>
      <service name="Table" url="http://127.0.0.1:10002/"/>
    </services>

To

<StorageEmulatorConfig>
    <services>
      <service name="Blob" url="http://127.0.0.1:30001/"/>
      <service name="Queue" url="http://127.0.0.1:30002/"/>
      <service name="Table" url="http://127.0.0.1:30003/"/>
    </services>

CodePudding user response:

Since you have specified different ports from the default, the connection string UseDevelopmentStorage=True will not work.

You will instead have to specify the full connection string manually in local.settings.json:

{
  "Values": {
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:30001/devstoreaccount1;QueueEndpoint=http://127.0.0.1:30002/devstoreaccount1;TableEndpoint=http://127.0.0.1:30003/devstoreaccount1;"
  }
}

Reference: https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio#connection-strings

CodePudding user response:

In addition to what juunas suggested, make sure azurite is running on your computer. If you are running it integrated from Visual studio you should find in the Output window by showing output from "Service Dependencies". Otherwise you can also run it from PowerShell or the VS Code extension.

  • Related