This article is a mirror article of machine translation, please click here to jump to the original article.

View: 18852|Reply: 0

[.NET Core] .net core FileProvider reads directory files

[Copy link]
Posted on 1/31/2019 8:35:29 AM | | | |
The file directory to be read is sent to the project directory

Register for a service in the Startup class

The middleware that reads the file is a code snippet

However, the file in the operation log directory cannot be read.
The path to .NET Core release is (under /bin/Debug/netcoreapp1.0/publish/) at the project root directory.
So this directory is also the directory where the app runs. If you use the above method to read the file, it should be in this directory, not the project directory
So the log directory is placed in the wrong location, put the log in the root directory of the project /bin/Debug/netcoreapp1.0/publish/
Then register the service in the Startup class instead
The document was read out smoothly

Then I wondered if I could read any directory file
According to my idea of debugging the program this time
Register the service in the Startup class instead
where @"f:\" is the directory you want to read, so that the directory you want to read is not limited to the application root directory.






Previous:Introduction to the Darknet framework
Next:SQL Server deletes backup bak files regularly
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com