c# - Proper way to include the Microsoft.Web.Administration assembly reference in VS 2010 -


i've encountered problem earlier already. time moving development environment 1 desktop , issue came back. note move solution old environment new 1 copied entire solution folder. when opened in new desktop, using same version of visual studio 2010, following code:

using (servermanager servermanager = new servermanager()) {     //go through sites     (int s = 0; s < servermanager.sites.count; s++) //exception here!!!     {         //do work     } } 

produced exception:

getadminsection; getsectioninternal; sitessectioncreator; initialize; sitescollectioncreator; initialize; collectdata. filename: redirection.config  error: cannot read configuration file 

why if running absolutely fine on old desktop... anyway, question:

what proper way include microsoft.web.administration assembly reference?

enter image description here

the way did linking dll via solution -> references -> add reference -> browser , point file:

c:\windows\system32\inetsrv\microsoft.web.administration.dll 

my concern exception pop on production machine when solution deployed there.

yes, correct way of referencing microsoft.web.administration assembly. available iis 7.0 , later though. have iis features installed (go turn windows features on or off wizard in control panel).

http://www.iis.net/learn/manage/scripting/how-to-use-microsoftwebadministration

this how instantiate servermanager, had similar issues similar yours:

servermanager iismanager = servermanager.openremote(environment.machinename.tolower()); 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -