Getting this error in an Azure .NET Core Web App deployed via GitHub?

An unhandled exception occurred while processing the request.

DirectoryNotFoundException: Could not find a part of the path ‘D:\home\site\wwwroot\Templates\my_file.html’.

System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)

  • DirectoryNotFoundException: Could not find a part of the path ‘D:\home\site\wwwroot\Templates\my_file.html’.
    • System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
    • System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
    • System.IO.FileStream..ctor(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options)
    • System.IO.StreamReader.ValidateArgsAndOpenPath(string path, Encoding encoding, int bufferSize)
    • System.IO.StreamReader..ctor(string path, Encoding encoding)
    • System.IO.File.InternalReadAllLines(string path, Encoding encoding)
    • System.IO.File.ReadAllLines(string path)

Chances are it hasn’t been copied up to the destination.

Check the file(s) have ‘Copy always’ or ‘Copy if newer’ checked (see above), make a minor mod, and then push the changes. Once the workflow has finished and a new deployment is made, the missing files will have been copied over.

Last modified: February 8, 2022

Author

Comments

Write a Reply or Comment

Your email address will not be published.