Reputation: 1
I have a Azure Linux DOTNET-ISOLATED|6.0 function runtime that keeps crashing with the following error:
A host error has occurred during startup operation
System.IO.IOException : Transport endpoint is not connected : '/home/site/wwwroot/host.json'
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo,String path,Boolean isDirectory,Func2 errorRewriter) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path,OpenFlags flags,Int32 mode) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath,FileMode mode,FileAccess access,FileShare share,FileOptions options,Int64 preallocationSize) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path,FileMode mode,FileAccess access,FileShare share,FileOptions options,Int64 preallocationSize) at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream,String path,FileMode mode,FileAccess access,FileShare share,Int32 bufferSize,FileOptions options,Int64 preallocationSize) at System.IO.StreamReader.ValidateArgsAndOpenPath(String path,Encoding encoding,Int32 bufferSize) at System.IO.File.InternalReadAllText(String path,Encoding encoding) at System.IO.File.ReadAllText(String path) at Microsoft.Azure.WebJobs.Script.Configuration.HostJsonFileConfigurationSource.HostJsonFileConfigurationProvider.LoadHostConfig(String configFilePath) at /src/azure-functions-host/src/WebJobs.Script/Config/HostJsonFileConfigurationSource.cs : 196 at Microsoft.Azure.WebJobs.Script.Configuration.HostJsonFileConfigurationSource.HostJsonFileConfigurationProvider.LoadHostConfigurationFile() at /src/azure-functions-host/src/WebJobs.Script/Config/HostJsonFileConfigurationSource.cs : 146 at Microsoft.Azure.WebJobs.Script.Configuration.HostJsonFileConfigurationSource.HostJsonFileConfigurationProvider.Load() at /src/azure-functions-host/src/WebJobs.Script/Config/HostJsonFileConfigurationSource.cs : 72 at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList
1 providers)
at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
at Microsoft.Azure.WebJobs.Script.ScriptHostBuilderExtensions.<>c__DisplayClass6_0.b__2(HostBuilderContext context,IConfigurationBuilder configBuilder) at /src/azure-functions-host/src/WebJobs.Script/ScriptHostBuilderExtensions.cs : 109
at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Microsoft.Azure.WebJobs.Script.WebHost.DefaultScriptHostBuilder.BuildHost(Boolean skipHostStartup,Boolean skipHostConfigurationParsing) at /src/azure-functions-host/src/WebJobs.Script.WebHost/DefaultScriptHostBuilder.cs : 59
at async Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.UnsynchronizedStartHostAsync(ScriptHostStartupOperation activeOperation,Int32 attemptCount,JobHostStartupMode startupMode) at /src/azure-functions-host/src/WebJobs.Script.WebHost/WebJobsScriptHostService.cs : 275
Restarting isn't solving that issue. If I try to reproduce the issue locally everything is working. I also tried to delete and redeploy the appservice & function without luck.
Upvotes: 0
Views: 1170
Reputation: 84
Usually, System.IO.IOException while trying to access host.json file would be seen when the Storage account associated with the Function app is not accessible. If you have Vnet configured with the Function app, please check if you have configured the storage account correctly as mentioned in this article.
Looking at the stack trace, it appears that your code might be trying to open file using SafeFileHandle. File handles are not supported in Azure functions as they run in a sandboxed environment. Please refer to the below article https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox/2215e418aef0e398e7b6d922f8063706a5856fe7#process-enumerationjob-assignment
If the above steps didn't help, please try to use the in-process function and check if it works.
Upvotes: 0