gpt4 book ai didi

Azure Function Nuget 缓存还原失败,错误代码为 "The user name or password is incorrect."

转载 作者:行者123 更新时间:2023-12-02 23:47:01 25 4
gpt4 key购买 nike

我有一个作为 ARM 模板的一部分部署的 Azure 函数。此 Azure 函数引用了一些外部 .NET DLL。我已在 project.json 文件中添加了对这些 DLL 的引用:

项目.json:

{
"frameworks": {
"net46": {
"dependencies": {
"Microsoft.IdentityModel.Clients.ActiveDirectory":"3.13.8",
"Newtonsoft.Json": "10.0.2",
"Microsoft.CrmSdk.CoreAssemblies" : "8.2.0.2"
}
}
}
}

当我单击“运行”时,Nuget 缓存恢复将启动。它失败并显示“用户名或密码不正确。”

奇怪的是 Nuget 包已正确复制到 Functions Nuget 缓存,但无法创建 project.lock.json 文件。 Nuget 缓存还原完成后以及 Azure 尝试写入 project.lock.json 文件时,似乎会引发用户名/密码错误。然后编译失败,因为未创建 project.lock.json 文件。

2017-11-14T21:06:34.892 Restoring packages.
2017-11-14T21:06:34.892 Starting NuGet restore
2017-11-14T21:06:36.239 Function started (Id=1340feea-174d-4bee-97f2-e06afc2e2d6e)
2017-11-14T21:06:36.239 Package references have been updated.
2017-11-14T21:06:36.239 Restoring packages.
2017-11-14T21:06:36.239 Starting NuGet restore
2017-11-14T21:06:36.955 Restoring packages for D:\home\site\wwwroot\ProvisionUserToCRM\project.json...
2017-11-14T21:06:37.456 CACHE https://api.nuget.org/v3-flatcontainer/microsoft.identitymodel.clients.activedirectory/index.json
2017-11-14T21:06:37.486 CACHE https://api.nuget.org/v3-flatcontainer/microsoft.identitymodel.clients.activedirectory/3.13.8/microsoft.identitymodel.clients.activedirectory.3.13.8.nupkg
2017-11-14T21:06:37.705 CACHE https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
2017-11-14T21:06:37.705 CACHE https://api.nuget.org/v3-flatcontainer/newtonsoft.json/10.0.2/newtonsoft.json.10.0.2.nupkg
2017-11-14T21:06:37.800 CACHE https://api.nuget.org/v3-flatcontainer/microsoft.crmsdk.coreassemblies/index.json
2017-11-14T21:06:37.800 CACHE https://api.nuget.org/v3-flatcontainer/microsoft.crmsdk.coreassemblies/8.2.0.2/microsoft.crmsdk.coreassemblies.8.2.0.2.nupkg
2017-11-14T21:06:37.881 CACHE https://api.nuget.org/v3-flatcontainer/microsoft.identitymodel/index.json
2017-11-14T21:06:37.881 CACHE https://api.nuget.org/v3-flatcontainer/microsoft.identitymodel/6.1.7600.16394/microsoft.identitymodel.6.1.7600.16394.nupkg
2017-11-14T21:06:38.002 Installing Microsoft.IdentityModel 6.1.7600.16394.
2017-11-14T21:06:38.362 Installing Microsoft.CrmSdk.CoreAssemblies 8.2.0.2.
2017-11-14T21:06:38.939 Restoring packages for D:\home\site\wwwroot\ProvisionUserToCRM\project.json...
2017-11-14T21:06:39.113 Installing Newtonsoft.Json 10.0.2.
2017-11-14T21:06:39.255 CACHE https://api.nuget.org/v3-flatcontainer/microsoft.identitymodel.clients.activedirectory/index.json
2017-11-14T21:06:39.284 CACHE https://api.nuget.org/v3-flatcontainer/microsoft.identitymodel.clients.activedirectory/3.13.8/microsoft.identitymodel.clients.activedirectory.3.13.8.nupkg
2017-11-14T21:06:39.455 CACHE https://api.nuget.org/v3-flatcontainer/newtonsoft.json/index.json
2017-11-14T21:06:39.455 CACHE https://api.nuget.org/v3-flatcontainer/newtonsoft.json/10.0.2/newtonsoft.json.10.0.2.nupkg
2017-11-14T21:06:39.470 CACHE https://api.nuget.org/v3-flatcontainer/microsoft.crmsdk.coreassemblies/index.json
2017-11-14T21:06:39.470 CACHE https://api.nuget.org/v3-flatcontainer/microsoft.crmsdk.coreassemblies/8.2.0.2/microsoft.crmsdk.coreassemblies.8.2.0.2.nupkg
2017-11-14T21:06:39.490 CACHE https://api.nuget.org/v3-flatcontainer/microsoft.identitymodel/index.json
2017-11-14T21:06:39.502 CACHE https://api.nuget.org/v3-flatcontainer/microsoft.identitymodel/6.1.7600.16394/microsoft.identitymodel.6.1.7600.16394.nupkg
2017-11-14T21:06:39.642 Installing Microsoft.IdentityModel.Clients.ActiveDirectory 3.13.8.
2017-11-14T21:06:41.211 Installing Microsoft.IdentityModel 6.1.7600.16394.
2017-11-14T21:06:42.367 Installing Microsoft.CrmSdk.CoreAssemblies 8.2.0.2.
2017-11-14T21:06:46.398 Installing Microsoft.IdentityModel.Clients.ActiveDirectory 3.13.8.
2017-11-14T21:06:49.197 Installing Newtonsoft.Json 10.0.2.
2017-11-14T21:06:52.171 The user name or password is incorrect.
2017-11-14T21:06:52.189
2017-11-14T21:06:52.189
2017-11-14T21:06:52.189 Packages restored.
2017-11-14T21:06:52.500 Script for function 'ProvisionUserToCRM' changed. Reloading.
2017-11-14T21:06:52.813 run.csx(2,18): error CS0234: The type or namespace name 'IdentityModel' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
2017-11-14T21:06:52.813 run.csx(3,8): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)

有谁知道为什么会显示此错误?对我来说似乎是断断续续的。似乎是 Azure Functions 中的错误。有任何已知的解决方法吗?

我发现在 Azure Functions 上启用“插槽”预览功能实际上可以解决此问题,但“插槽”对我不起作用,因为它们与 Azure 逻辑应用不兼容。

最佳答案

看来 Microsoft 已确认这是 Azure Functions 中的错误 https://github.com/Azure/Azure-Functions/issues/590

我知道的唯一解决方法是:

  • 启用插槽功能
  • 不断重新部署您的 ARM 模板,直至其正常工作
  • (我没有验证这一点)但我怀疑如果您手动生成锁定文件并将其删除到 Functions 文件系统,它会起作用。您可以使用 Visual Studio 在本地生成锁定文件。我怀疑这会起作用,因为根据我的观察,NuGet 包似乎已正确恢复,并且在写入 JSON 文件期间出现错误。编译器在尝试编译时必须引用锁定文件而不是实际的 NuGet 缓存(这就是为什么即使 DLL 实际存在也会出现错误)。

关于Azure Function Nuget 缓存还原失败,错误代码为 "The user name or password is incorrect.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47295401/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com