0
votes

Here is the code of my Azure function created in Azure portal:

#r "D:\home\site\wwwroot\TimerTriggerCSharp1\bin\MobileWebAPI.dll"
using System.Net;
using MobileWebAPI.Controllers;

public static void Run(TimerInfo myTimer, TraceWriter log)
{
    PayslipListController.NotifyUsersWithNewPayroll();
}

Error:

Exception has been thrown by the target of an invocation. System: Unable to connect to the remote server. System: An attempt was made to access a socket in a way forbidden by its access permissions to IP host.

The method NotifyUsersWithNewPayroll is calling a POST API.

1
is it working locally ? where do you store the API url to call ? Did you add it to the app settings blade in the portal ? - Thomas
Could you share code of NotifyUsersWithNewPayroll method? I am not sure it's Function's problem. - kamil-mrzyglod

1 Answers

0
votes

Already fix the issue. See code below.

#r "D:\home\site\wwwroot\TimerTriggerCSharp1\bin\MobileWebAPI.dll"
using System.Net;
using MobileWebAPI.Controllers;

public static void Run(TimerInfo myTimer, TraceWriter log)
{
    PayslipListController.NotifyUsersWithNewPayroll();
    //log.Info($"C# Timer trigger function executed at: {DateTime.Now}");


}