-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
index.html default file not found when using UseDefaultFiles and MapStaticAssets (ASP.NET 9) #59399
Comments
don't use app.MapStaticAssets(); |
Since |
Yeah, I mean, one wouldn't even need an expensive ASP.NET Core Host to serve static HTML only anyways, the point of all that is, that serving of application assets should be optimized. I faced the same issue today and to me it rather seems that it is a problem with Hot Reload than with the middleware itself. Disabling Hot Reload in Visual Studio did fix the issue and the static index.html was served without errors. So to verify that:
So the issue likely is a combination of Hot Reload with MapStaticAssets() |
This happens on a deployment environment so I doubt it’d just be a hot reload issue. |
Oh alright, I only saw the issue on my local machine for now. |
Is there an existing issue for this?
Describe the bug
I'm currently learning ASP.NET Core.
From an empty .NET 9 Web application, I added a wwwroot folder with an index.html file.
In Program.cs, I used UseDefaultFiles and MapStaticAssets as follows :
Expected Behavior
The expected behavior is simply to see my index.html page rendered by the brower.
Steps To Reproduce
Github repo with the simpliest sln to reproduce the issue: MapStaticAssets-issue
Exceptions (if any)
No response
.NET Version
9.0.101
Anything else?
VS 2022 17.12.3
dotnet --info:
SDK .NET :
Version: 9.0.101
Commit: eedb237549
Workload version: 9.0.100-manifests.4a280210
MSBuild version: 17.12.12+1cce77968
Environnement d'exécution :
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.101\
Charges de travail .NET installées :
[android]
Source de l’installation: VS 17.12.35527.113
Version de manifeste: 35.0.7/9.0.100
Chemin d'accès au Manifeste: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.android\35.0.7\WorkloadManifest.json
Type d'installation: Msi
[aspire]
Source de l’installation: VS 17.12.35527.113
Version de manifeste: 8.2.2/8.0.100
Chemin d'accès au Manifeste: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Type d'installation: Msi
[maui-windows]
Source de l’installation: VS 17.12.35527.113
Version de manifeste: 9.0.0/9.0.100
Chemin d'accès au Manifeste: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maui\9.0.0\WorkloadManifest.json
Type d'installation: Msi
[maccatalyst]
Source de l’installation: VS 17.12.35527.113
Version de manifeste: 18.1.9163/9.0.100
Chemin d'accès au Manifeste: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maccatalyst\18.1.9163\WorkloadManifest.json
Type d'installation: Msi
[ios]
Source de l’installation: VS 17.12.35527.113
Version de manifeste: 18.1.9163/9.0.100
Chemin d'accès au Manifeste: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.ios\18.1.9163\WorkloadManifest.json
Type d'installation: Msi
Configuré pour utiliser loose manifests lors de l’installation de nouveaux manifestes.
Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4
.NET SDKs installed:
9.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
The text was updated successfully, but these errors were encountered: