我的团队在 Elastic Premium 计划中运行 FunctionApp。默认情况下,这些函数使用 Azure 文件进行存储来运行,但我们尝试从包文件运行我们的函数,因此我们避免了这种依赖性。
我添加了 WEBSITE_RUN_FROM_PACKAGE = 1 并从应用程序设置中删除了 WEBSITE_CONTENTAZUREFILECONNECTIONSTRING/WEBSITE_CONTENTSHARE。我还更新了部署模板以使用 ZipDeploy 而不是 MSDeploy。我们的部署分两个阶段进行,首先部署资源(计划、功能应用程序...),然后部署代码(ZipDeploy)。
现在,部署在我们的一个环境中成功,但对于另一种环境,我们可以使用正确的应用程序设置部署函数应用程序,但 ZipDeploy 失败并显示: IOException:用户名或密码不正确。有什么奇怪的,因为两个功能应用程序的配置完全相同。
这是完整的错误消息:
Status: Failed
Error:
Code: TooManyRequests
Message: [IOException]: The user name or password is incorrect.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
at System.IO.Abstractions.DirectoryWrapper.CreateDirectory(String path)
at Kudu.Core.Infrastructure.FileSystemHelpers.EnsureDirectoryIgnoreAccessExceptions(String path)
at Kudu.Services.Web.App_Start.NinjectServices.GetSettingsPath(IEnvironment environment) in C:\__w\1\s\Kudu.Services.Web\App_Start\NinjectServices.cs:line 828
at Kudu.Services.Web.App_Start.NinjectServices.EnsureValidDeploymentXmlSettings(IEnvironment environment) in C:\__w\1\s\Kudu.Services.Web\App_Start\NinjectServices.cs:line 0
at Kudu.Services.Web.App_Start.NinjectServices.RegisterServices(IKernel kernel) in C:\__w\1\s\Kudu.Services.Web\App_Start\NinjectServices.cs:line 157
at Kudu.Services.Web.App_Start.NinjectServices.CreateKernel() in C:\__w\1\s\Kudu.Services.Web\App_Start\NinjectServices.cs:line 132
at Ninject.Web.Common.Bootstrapper.Initialize(Func`1 createKernelCallback)
at Kudu.Services.Web.App_Start.NinjectServices.Start() in C:\__w\1\s\Kudu.Services.Web\App_Start\NinjectServices.cs:line 97
[TargetInvocationException]: Exception has been thrown by the target of an invocation.
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at WebActivatorEx.BaseActivationMethodAttribute.InvokeMethod()
at WebActivatorEx.ActivationManager.RunActivationMethods[T](Boolean designerMode)
at WebActivatorEx.ActivationManager.Run()
[InvalidOperationException]: The pre-application start initialization method Run on type WebActivatorEx.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation..
at System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures)
at System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods)
at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)
at System.Web.Compilation.BuildManager.ExecutePreAppStart()
at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
[HttpException]: The pre-application start initialization method Run on type WebActivatorEx.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation..
at System.Web.HttpRuntime.FirstRequestInit(HttpContext context)
at System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
另外,如果我尝试 KUDO: 工藤
我尝试重新部署但没有成功。
有人在尝试使用 WEBSITE_RUN_FROM_PACKAGE = 1 时遇到同样的问题并有解决方案吗?
当我删除
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING
和 WEBSITE_CONTENTSHARE
设置并使用 Elastic Premium 在 Azure 函数应用程序中重新部署我的 Azure 函数触发器时,我收到了相同的错误,Kudu 堆栈跟踪不可用且函数无法正常工作。
还需要添加以下设置和来解决
The user name or password is incorrect error
,
感谢 @ahmelsayed Github Comment 和 @Pravallika SO 回答 - 重新生成存储帐户密钥并在 Account keys
、
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING
和
WEBSITE_CONTENTSHARE
设置值中添加新的
AzureWebJobsStorage
作为连接字符串:-
我将以下设置重新添加为
Advanced edit
,并且 Log stream
再次开始成功工作:-
当我重新添加上述设置时,功能开始成功运行:-
{
"name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
"value": "DefaultEndpointsProtocol=https;AccountName=siliconrg80bd;AccountKey=<RecheckAccountKeyORRegenerate>;EndpointSuffix=core.windows.net",
"slotSetting": false
},
{
"name": "WEBSITE_CONTENTSHARE",
"value": "siliconfunc98085a5",
"slotSetting": false
},
{
"name": "AzureWebJobsStorage",
"value": "DefaultEndpointsProtocol=https;AccountName=siliconrg80bd;AccountKey=<RecheckAccountKeyORRegenerate>;EndpointSuffix=core.windows.net",
"slotSetting": false
},
{
"name": "WEBSITE_RUN_FROM_PACKAGE",
"value": "1",
"slotSetting": false
}
输出:-
如果您使用
Publish Profile
进行功能部署,请重新检查 zip 部署的发布配置文件中的用户名和密码值或 Reset Publish profile
:-
Publishprofile.publishsettings:-
Zip Deploy" publishMethod="ZipDeploy" publishUrl="siliconfunc980.scm.azurewebsites.net:443" userName="$siliconfunc980" userPWD="yxxxxxxxxxxxxxEnC"