Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I get ASP.NET to restart when a file is changed?
    primarykey
    data
    text
    <p>I have an ASP.NET application that is part of a much larger system; it reads most of its configuration from files that are above the root level of the web application.</p> <p>As the application is already written and the format of the configuration files was chosen to ease editing by customers I cannot make use of the solution in <a href="https://stackoverflow.com/questions/820811/shared-configuration-files-in-net">“Shared configuration files in .NET”.</a></p> <p>I am hoping ASP.NET has an API I can call at startup time to tell it which file to watch. (I could write this the hard way using a “FileSystemWatcher” and catching events then doing the restart myself, however that would be a pity as ASP.NET already has the code to watch files and restart when they are changed.)</p> <p>Also what ASP.NET API do I call to get ASP.NET to restart in a nice way?</p> <p>These are some links I have found that may help: <a href="http://aspadvice.com/blogs/ericm/archive/2005/08/05/2706.aspx" rel="nofollow noreferrer">Using the FileSystemWatcher from ASP.NET</a> and <a href="http://www.vsj.co.uk/dotnet/display.asp?id=381" rel="nofollow noreferrer">Extending FileSystemWatcher to ASP.NET</a></p> <hr> <p>In one case I cached the configuration in the ASP.NET Cache and set a CacheDependency to the file. In the other case that needed faster access, I used a FileSystemWatcher and updated a static field when the configuration changed.</p> <p>(I never did find out how to restart ASP.NET from code in a reasonable way.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload