azure - Azure Functions 禁止访问 API
问题描述
这是我在 Azure 门户中创建的 Azure 函数的代码:
#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();
}
错误:
调用的目标已引发异常。系统:无法连接到远程服务器。系统:试图以一种被其对 IP 主机的访问权限所禁止的方式访问套接字。
该方法NotifyUsersWithNewPayroll
正在调用一个POST API
.
解决方案
已经解决问题了。请参阅下面的代码。
#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}");
}
推荐阅读
- python - Pandas 复制粘贴值而不将值转换为 NaN
- python - 如何使用 Antlr 解析 Python 代码中的符号?
- python - `Flask run` 完美运行,(FLASK_APP=main.py)但 'python main.py' 产生错误
- c++ - 默认移动成员定义为已删除,当没有定义特殊成员时?
- android - 如何通过与另一点的距离和方向计算一个点的纬度和经度
- android - 如何在 android 应用程序中使共享首选项全局可用?
- javascript - 直接发布到 Facebook 没有共享对话框问题
- arrays - “如何从 Ruby 数组中删除一个元素,该元素只是另一个元素的反转?”
- php - PHP 生成器:即使调用了 break,如何始终清理资源?
- mysql - COUNT(*) 附近的语法不正确