by
Roland Schumacher alias GENiALi
16. August 2010 -- 208
words -- 1 mal gelesen
If hide in BlogEngine.NET an extension or is turned on a message that one tells that on the Web.config cannot be changed. This is because that the extension manager is trying a change in status of an extension, to start the blog. That slightly modifies the Web.config will be tried. Whenever the Web.config, the Web is automatically restarted.
To prevent the error, one would have to give the account, which runs the Web, write rights to the Web.config. If you have an own IIS this is no problem. A shared hosting that is but not always. I can change any rights to the files in the root directory. The Web.config is always read-only for the Web application. It is then getting the error.
You may restart but still unlike the Web. With HttpRuntime.UnloadAppDomain(); to reach the same without the error message and felt more quickly. Be adjusted the following needs.
In the ExtensionManager.cs:
public static void ChangeStatus(string extension, bool enabled)
{
foreach (ManagedExtension x in _extensions)
{
if (x.Name == extension)
{
x.Enabled = enabled;
BlogEngine.Core.DataStore.ExtensionSettings xs = new BlogEngine.Core.DataStore.ExtensionSettings(x.Name);
xs.SaveSettings(x);
SaveToCache();
//string ConfigPath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + "Web.Config";
//File.SetLastWriteTimeUtc(ConfigPath, DateTime.UtcNow);
HttpRuntime.UnloadAppDomain();
break;
}
}
}Lines 12 and 13 are commented out. The line 15 is new and causes a restart of the Web application.
d23292fe-cce9-42ff-a39f-a9073ae22664|0|.0
Tags: