我正在尝试开发一个使用计时器触发器的函数应用,但 Windows 平台 FIPS 遇到问题,导致计时器触发的函数无法在本地启动。 以下是导致错误的代码(这是默认的计时器触发函数(:
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
namespace FunctionApp1
{
public static class Function1
{
[FunctionName("Function1")]
public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, TraceWriter log)
{
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
}
}
}
当我尝试在 func.exe 中运行此函数时,它会产生以下错误:
The listener for function 'Function1' was unable to start. mscorlib: Exception has been thrown by the target of an invocation. mscorlib: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.
此确切代码适用于我有权访问的另一个开发环境。 我需要执行哪些操作才能修复这些 Windows 平台 FIPS 问题,以便计时器触发器运行?
谢谢!
如果你的环境确实在某处需要此 FipsAlgorithmPolicy,请仅为 Azure 函数禁用它。
在文件资源管理器中,打开
%localappdata%AzureFunctionsToolsReleases1.4.0clifunc.exe.Config
,在<runtime>
元素下添加<enforceFIPSPolicy enabled="false"/>
。请注意,通过这种方式,您必须在发布新功能 cli 后重复此步骤。同样,如果在本地使用存储模拟器,请在 element 下打开
C:Program Files (x86)Microsoft SDKsAzureStorage EmulatorAzureStorageEmulator.exe.config
,添加<enforceFIPSPolicy enabled="false"/>
。
否则,只需为您的计算机禁用FipsAlgorithmPolicy。
在搜索框中或右键单击"开始"按钮并单击"运行",输入
regedit
以打开注册表编辑器。在地址栏(视图>地址栏(中,导航到
ComputerHKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlLsaFipsAlgorithmPolicy
。双击
Enabled
,将值数据更改为 0。