Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

State property of Site throwing "NotImplementedException" in IIS Express

I am using Microsoft.Web.Administration.dll to check states of my sites by using following code. It works fine with IIS but when it's used in IIS Expresss, then 'State' property throws 'NotImplementedException'.

ServerManager manager = new ServerManager()
foreach (Site site in manager.Sites){
   If (site.State == ObjectState.Started)
   {
        .....
   }
}

Has anyone faced this issue?

like image 661
NalinBhatia Avatar asked May 05 '14 07:05

NalinBhatia


2 Answers

It seems for IISExpress, property 'State' is not implemented. I tried to use de-compilers to search for implementation of this property but couldn't find it. It seems lot of code is hidden underneath the layers of COM dlls.

So, for now I am not using this property.

like image 188
NalinBhatia Avatar answered Nov 15 '22 04:11

NalinBhatia


The assembly Microsoft.Web.Administration.dll automatically loaded from GAC (even if you reference IIS assembly) is an IIS Express module and not implements property "State"

like image 29
Leon Pro Avatar answered Nov 15 '22 03:11

Leon Pro