Open Closed

Azure hosted MVC error: Could not find a file/folder at the location (Quick fix solution) #6201


User avatar
0
abp@davegrey.co.uk created
  • ABP Framework version: v7.4
  • UI Type: MVC
  • Database System: EF Core
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I've spent the evening trying to get an email template sending when a new user has been created. After looking around for a few examples I had the same issue as others where it works locally but not when hosted in Azure. Looking at the log.txt I found this error which meant the virtual files weren't being found.

2023-11-20 20:50:12.456 +00:00 [ERR] Could not find a file/folder at the location: /Emailing/Templates/NewUserWelcome.tpl Volo.Abp.AbpException: Could not find a file/folder at the location: /Emailing/Templates/NewUserWelcome.tpl

Short version, I found the answer / workaround on stackoverflow. Copy your email template folder + .tpl file and put it in the Domain.Shared rather than the Application project and it'll work. If you have got everything else in place but its not working, this might be the last step required:

https://stackoverflow.com/questions/75113191/abp-framework-cant-acces-virtual-files-in-deploy


1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    This is because the DomainShared has builtin AbpVirtualFileSystem configure.

    https://docs.abp.io/en/abp/latest/Virtual-File-System#working-with-the-embedded-files

    Configure<AbpVirtualFileSystemOptions>(options =>
    {
        options.FileSets.AddEmbedded<MyProjectNameDomainSharedModule>();
    });
    
     <GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest>
    
      <ItemGroup>
        <EmbeddedResource Include="*.tpl" />
        <Content Remove="*.tpl" />
      </ItemGroup>
    
      <ItemGroup>
        <PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="8.0.0" />
      </ItemGroup>
    
Made with ❤️ on ABP v9.1.0-preview. Updated on December 10, 2024, 06:38