Provide an API to configure the TempDirectory used by ASP.NET Core
See original GitHub issueASP.NET Core currently uses an environment variable to drive the temp directory, falling back Path.GetTempPath()
. See https://github.com/aspnet/AspNetCore/blob/56e2080ef7741dea9a5c24a8e0639b0921be2d22/src/Http/Http/src/Internal/BufferingHelper.cs#L18-L39.
This path is currently in use by FileBufferingReadStream
and as of https://github.com/aspnet/AspNetCore/pull/9015 change, by FileBufferingWriteStream
.
This is one of the few parts of the stack that is only configurable via environment variable. We should instead follow the regular pattern of having an option type (that can be configured via configuration) and use those in when constructing these streams and everywhere else ASP.NET Core may need to write to the temp directory.
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Where is the ASP.NET Core 2.2 temp-directory in?
For ASP.NET MVC5 (.net4.8) the ASP.NET temporary directories are: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.
Read more >FileSystemConfiguration.TempDirectory Property
FileSystemConfiguration.TempDirectory Property ... Specifies the path to the directory where temporary files are stored. Namespace: DevExtreme.AspNet.Mvc.
Read more >Tutorial: Create a web API with ASP.NET Core
This tutorial teaches the basics of building a controller-based web API that uses a database. Another approach to creating APIs in ASP.NET Core...
Read more >Locating special folders in cross-platform .NET applications
Use .NET APIs to portably locate special folders (app and user data/confgiuration) in your cross-platform applications.
Read more >How do I find which directory my .NET Core console ...
Every method for finding the startup assembly's location I have found, either by googling or exploring with reflection while it runs, only gives ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We’re slowly trying to replace any APIs in the Internal namespace with fully internal or fully public types. It it’s needed by MVC and others then it needs to be in a public namespace.
Hey @Tratcher, I could use your help here 😃
Since the code of the
Func<string>
factory would be the same one used in the callers, I was planning on adding this method to a place that can be shared easily. I thought about adding it to the currentAspNetCoreTempDirectory
class inMicrosoft.AspNetCore.WebUtilities
which seems OK for theEnableRewind
inMicrosoft.AspNetcore.Http
with the file linked.However I’m not sure, since currently it’s internal and in the Http group of projects, if I should refer to this class from the MVC formatters same way
Microsoft.AspNetcore.Http
is doing, add that factory in another place, just repeat the code in all the callers, or any other option that you may think about.Thanks!