I am trying to restart my ASP.net Core application and for this purpose I'm changing the modification date of Web.config
. As I expected it should force my application to be restarted but surprisingly it doesn't make any changes.
I did this modification by File.SetLastWriteTimeUtc(path, DateTime.UtcNow);
Asked
Active
Viewed 281 times
1

Alien
- 15,141
- 6
- 37
- 57

alireza khosravi
- 405
- 2
- 17
-
What is your operating system? – Amin Mozhgani Oct 01 '18 at 05:25
-
@AminMozhgani, mac os and I use visual studio for mac – alireza khosravi Oct 01 '18 at 05:26
-
1Web.config would not be useful for asp.net core applications unless your application is hosted on IIS. i think for the chagnes to be reflected you need to make your changes in appsettings.json – user3785553 Oct 01 '18 at 06:38
-
@user3785553, I did but unfortunately your advise does not work – alireza khosravi Oct 01 '18 at 08:10
-
Try this! https://stackoverflow.com/questions/36121999/how-to-restart-asp-net-core-app-programmatically – John Oct 01 '18 at 11:19
-
@John, I try use this source but my version of .net core is deferent. I use .net core 2.1 and in this version IWebHelper.Run() method has not any parameters. – alireza khosravi Oct 02 '18 at 07:34
-
@alirezakhosravi Try keeping configurations in `appsettings.json` itself. – prisar Oct 04 '18 at 06:32