我有一个Azure功能,我部署为ARM模板的一部分。此Azure函数引用了一些外部.NET DLL。我在project.json文件中添加了对这些DLL的引用:
project.json:
{
"frameworks": {
"net46": {
"dependencies": {
"Microsoft.IdentityModel.Clients.ActiveDirectory":"3.13.8",
"Newtonsoft.Json": "10.0.2",
"Microsoft.CrmSdk.CoreAssemblies" : "8.2.0.2"
}
}
}
}
当我单击运行时,Nuget Cache恢复将启动。它失败并显示“用户名或密码不正确。”
奇怪的是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功能中的一个错误。有没有已知的工作?
我发现在Azure Functions上启用“Slots”预览功能实际上解决了这个问题,但“Slots”对我来说不起作用,因为它们与Azure Logic Apps不兼容。
答案 0 :(得分:2)
看起来Microsoft已经确认这是Azure Functions中的一个错误 https://github.com/Azure/Azure-Functions/issues/590
我所知道的唯一工作是: