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

View: 45168|Reply: 7

[.NET Core] ASP.NET Core (2) Restart the application by code

[Copy link]
Posted on 11/23/2020 3:48:39 PM | | | |
When doing plug-in website development, sometimes it is inevitable to restart the website, every time you log in to the server to restart the website is too troublesome, I think you can achieve self-restart of the application by clicking the button through the management background? Answer: Yes, it can be done

Principle: Deploy the asp.net Core project to IIS, stop the application through code, and when we visit the website again, IIS will automatically start the website for us.

Project version: ASP.NET Core 3.0

I have deployed my project on IIS, how to deploy it can be found here:

Deploy ASP.NET Core to IIS server
https://www.itsvse.com/thread-7838-1-1.html

First, we create a new test.json profile and Monitor file changes and reload mechanisms are prohibitedThis can demonstrate whether the application has been restarted, and of course, it can also observe changes in other ways.

Let's take a look at the renderings first:



Add the profile code as follows:

test.json File contents:

HomeController Controller Code:

In fact, the focus is on the following line of code:

(End)





Previous:.NET/C# Monitor Taobao and Tmall product inventory source codes
Next:The newcomer came to report
Posted on 9/22/2021 8:30:26 PM |
Learn to learn.
 Landlord| Posted on 9/22/2021 8:31:34 PM |

Lao Tie, don't brush it, you can't use it now
Posted on 9/22/2021 8:51:42 PM |
Small slag Posted on 2021-9-22 20:31
Lao Tie, don't brush it, you can't use it now

If there is something new, you have to take a look, in case you need it one day, keep it first
Posted on 9/22/2021 8:54:10 PM |
Flying Fish Posted on 2021-9-22 20:51
If there is something new, you have to take a look, in case you need it one day, keep it first

Don't learn, you can't keep up.
Posted on 9/24/2021 10:33:39 AM |
Learn to learn! ~~~~~~~~~~~
Posted on 10/12/2021 1:58:27 PM |
Just thinking about researching this
Posted on 2/16/2023 9:31:57 PM |
Small slag Posted on 2021-9-22 20:31
Lao Tie, don't brush it, you can't use it now

When the book arrives, it is regrettable that there are few
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