Static File Casing Changed or Missing in .NET 8 Deployment

joerdie
FREE

2 months ago

I’m deploying a .NET 8 app with static files served from wwwroot/images/MainLayoutImages. My .csproj explicitly includes all content using:

<Content Include="wwwroot\**\*.*" CopyToPublishDirectory="PreserveNewest" />

When I inspect the output of dotnet publish, the folder and filenames are exactly correct and match the casing used in my HTML views — for example:

wwwroot/images/MainLayoutImages/01JoerdieHeadshot.jpg

However, in production, requests to:

https://<myapp>.railway.app/images/MainLayoutImages/01JoerdieHeadshot.jpg

return a 404.

If I manually change the image casing in the browser to match a different pattern, the image may resolve — which suggests the deployed casing is being altered or excluded.

I've confirmed:

  • No casing mismatch in source or publish output

  • No exclusion rules in .csproj

  • Publish folder on local matches what I expect

  • Logs confirm 404s at deployment, not runtime errors

Can you confirm whether Railway:

  1. Alters static file casing during publish/build?

  2. Applies any special handling to /wwwroot folders?

Thanks — I’ve spent multiple days tracing this and can provide my repo or deploy link if needed.

$10 Bounty

2 Replies

sim
FREETop 1% Contributor

24 days ago

I do not know what Railway does but if you update the casing for folders like this wwwroot/images/MainLayoutImages/ to kebab-case?


sim
FREETop 1% Contributor

24 days ago

If no progress, share the repo etc and I will look closer


Static File Casing Changed or Missing in .NET 8 Deployment - Railway Help Station