I’ve generally released applications on .NET Framework 4.8 on IIS and have never had the problem I’m having with this ASP.NET Core 5.0 application.
In Startup.cs
, I have:
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider("Fully/Qualified/Path"),
RequestPath = new PathString("Relative/Path")
});
What is confusing me is that originally my wwwroot
folder wasn’t being added to the bin
folder when I was building, yet it was still able to access the content. I did add to the .csproj
the code below to force it into the bin
directory whenever I build
<ItemGroup>
<Content Update="wwwroot\**\*">
<CopyToOutputDirectory>PreserveNewset</CopyToOutputDirectory>
</Content>
</ItemGroup>
When I did the first delivery to our Cloud One Azure instance, everything worked as expected, but all subsequent deliveries would used the same original cached content within wwwroot
and I’m stumped at what is holding on to it.
To take it a step further, we allow users to upload profile pictures to the site. The first picture they upload is correctly referenced and I can browse to the physical location on the server with the image and tell that it is correct. However, when I then upload a new image, logic on the server deletes the old image and replaces it with the new image – which I can verify on the servers file system directly – but the site will still permanently display the first image.