ASP.NET COREs ASP-Append-Version-Attribut funktioniert nicht für statische Dateien außerhalb des WWWROOT-Verzeichnisses

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: ASP.NET COREs ASP-Append-Version-Attribut funktioniert nicht für statische Dateien außerhalb des WWWROOT-Verzeichnisses

by Anonymous » 17 Aug 2025, 16:18

Ich habe ein ASP.NET -Kernprojekt mit statischen Dateien sowohl im Verzeichnis wwwroot und bower_components .

Code: Select all

StaticFileOptions rootFileOptions = new StaticFileOptions();
rootFileOptions.OnPrepareResponse = staticFilesResponseHandler;
StaticFileOptions bowerFileOptions = new StaticFileOptions();
bowerFileOptions.OnPrepareResponse = staticFilesResponseHandler;
string bowerDirectory = Path.Combine(Directory.GetCurrentDirectory(), "bower_components");
PhysicalFileProvider bowerPhysicalFileProvider = new PhysicalFileProvider(bowerDirectory);
bowerFileOptions.FileProvider = bowerPhysicalFileProvider;
bowerFileOptions.RequestPath = new PathString("/bower");
app.UseStaticFiles(rootFileOptions);
app.UseStaticFiles(bowerFileOptions);
< /code>

und verweisen Sie sie dann aus meinen Ansichten wie folgt: < /p>



Obwohl ASP-Append-Version für Ressourcen, die sich unter wwwroot befinden, gut zu funktionieren scheint, scheint es für Ressourcen außerhalb von wwwroot vollständig ignoriert zu sein. Alle Ressourcen werden jedoch ordnungsgemäß bedient; Nein 404 oder so. Das resultierende HTML für den obigen Code ist wie folgt: < /p>



< /code>

Was mache ich falsch? < /p>

Top