3

I've build an Azure function. I can deploy it from Visual Studio directly (right click on project, then Publish) to my Azure FunctionApps without any problems. However, when I try to use Azure DevOps to build and deploy it, I receive the following error and I have no idea what it means. I don't even know what's a Kudu?

The network path was not found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: The network path was not found.


Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[IOException: The network path was not found.
]
   System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +12601718
   System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost) +12404913
   System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost) +88
   System.IO.Directory.CreateDirectory(String path) +34
   System.IO.Abstractions.DirectoryWrapper.CreateDirectory(String path) +10
   Kudu.Core.Infrastructure.FileSystemHelpers.CreateDirectory(String path) in C:\Kudu Files\Private\src\master\Kudu.Core\Infrastructure\FileSystemHelpers.cs:32
   Kudu.Core.Infrastructure.FileSystemHelpers.EnsureDirectoryIgnoreAccessExceptions(String path) in C:\Kudu Files\Private\src\master\Kudu.Core\Infrastructure\FileSystemHelpers.cs:48
   Kudu.Core.Environment.get_DeploymentsPath() in C:\Kudu Files\Private\src\master\Kudu.Core\Environment.cs:181
   Kudu.Services.Web.App_Start.NinjectServices.GetSettingsPath(IEnvironment environment) in C:\Kudu Files\Private\src\master\Kudu.Services.Web\App_Start\NinjectServices.cs:779
   Kudu.Services.Web.App_Start.NinjectServices.EnsureValidDeploymentXmlSettings(IEnvironment environment) in C:\Kudu Files\Private\src\master\Kudu.Services.Web\App_Start\NinjectServices.cs:0
   Kudu.Services.Web.App_Start.NinjectServices.RegisterServices(IKernel kernel) in C:\Kudu Files\Private\src\master\Kudu.Services.Web\App_Start\NinjectServices.cs:152
   Kudu.Services.Web.App_Start.NinjectServices.CreateKernel() in C:\Kudu Files\Private\src\master\Kudu.Services.Web\App_Start\NinjectServices.cs:129
   Ninject.Web.Common.Bootstrapper.Initialize(Func`1 createKernelCallback) +16
   Kudu.Services.Web.App_Start.NinjectServices.Start() in C:\Kudu Files\Private\src\master\Kudu.Services.Web\App_Start\NinjectServices.cs:95

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +91
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +105
   WebActivatorEx.BaseActivationMethodAttribute.InvokeMethod() +73
   WebActivatorEx.ActivationManager.RunActivationMethods(Boolean designerMode) +637
   WebActivatorEx.ActivationManager.Run() +101

[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..]
   System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +646
   System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +147
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +107
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +165
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +590

[HttpException (0x80004005): 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..]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10086640
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +99
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +263

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4261.0
Franky
  • 1,262
  • 2
  • 16
  • 31

3 Answers3

5

I got this. When I created my Azure Function App it generated a Storage Account on the fly. I didn't like the name, so I deleted the Storage Account and created one with a new name, but the connection string for my old deleted Storage Account was still in the App Settings for the Azure Function in the Azure Portal.

No storage, no Kudu. No Kudu, no way to publish your app.

Check the "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING" App Setting if it is pointing to an actual storage account that still exists.

CVOCVOCVO
  • 51
  • 1
  • 4
0

I had to delete and re-create the Function App service. Works now. Not sure what the problem was originally ...

Franky
  • 1,262
  • 2
  • 16
  • 31
0

I had this same problem, and indeed the issue was that the connection string to the Azure storage account was incorrect. However, after correcting it and restarting the app the issue was not gone. The issue was only gone after I used another storage account connection string, and then reverted back to the old account, with the correct connection string.

Not sure if this was just a synchronization issue, but that is what I had to do.

thiago
  • 23
  • 1
  • 5