Developer forum

Forum » Hosting » Setup to allow "Recycle application pool" from backend

Setup to allow "Recycle application pool" from backend

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I cannot figure out how I need to set up the Application pool (or something else) in order to be able to access the "Recycle application pool" functionality under the HTTP section in the backend.

I see that Dynamicweb hosted applications have this option available and I believe it is a matter of how the environment is configured.

Thank you,
Adrian


Replies

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

Can anybody help me out with this request?

I believe it is a matter of setting the right permissions for the application pool but I am not very familiar with this.

My aim is to be able to recycle the application pool from the back-end and also perform upgrades of the solution without having to use IIS Manager.

Thank you,
Adrian

 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply

Hi Adrian,

I haven't used the Dynamicweb feature for this so I can only make some assumptions. For the site to be able to recycle the app pool, the app pool will need to run with administrator or SYSTEM permissions. That reduces the security since the sites will no longer be isolated from each other, and if there is a hack on the site, the hacker can own the whole server rather than just the site. So, it's not ideal to do that. But, if you understand the rights, the solution is to edit the IIS App Pool and set the Identity to local system. That should enable the feature to work.

There is another option that is better, if it works for you. That's to run a recycle on the AppDomain. That will cause an AppDomain (not App Pool) recycle, which will usually achieve the same goal. The nice thing about that is that you don't have to elevate to system/admin privileges. To do this, you'll need to write a frontend page for them to run, obviously behind a login. 

To do so, you just need a simple page with the following Razor code:

@{
System.Web.HttpRuntime.UnloadAppDomain();
}
 
Scott
 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Scott,

Thank you very much for the (as always) detailed information.

I was not aware of the security issue. I have noticed that DW websites hosted in Cloud offer this option from the back-end as well as another option to manage the application version. In my view, they were related.

The security aspect is pretty important and if there are no solutions for it, I can stick with editing the web config when I need to recycle :)

Not exactly the cleanest way but it does the trick :)

Thank you,

Adrian 

 
Scott Forsyth Dynamicweb Employee
Scott Forsyth
Reply
This post has been marked as an answer

Hi Adrian,

Yes, managing the application version also needs the same elevated permissions. 

Touching web.config works for manual situations. I will say that I have actually used the UnloadAppDomain script example that I provided. If it's rarely needed but you need it occasionally for someone with access to the backend then the band-aid solution is to create a page in the backend that is unpublished. Just create a simple template that is pretty much just what I included above. Give the page a terrible name like "CAREFUL - RecycleAppDomain". Since it's unpublished, it will only be run by someone from the backend when they really need it. I realize that it's not very graceful, but if you're looking for a solution for the occasional situation by someone with access to the backend, that does the job. You can pretty it up with an "Are you sure?" option if you want.

Scott

Votes for this answer: 1
 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Scott,

Your suggestion is way more elegant than mine.

I will surely implement it in our solutions.

Thank you very much.


Adrian

 

You must be logged in to post in the forum