State property of Site throwing “NotImplementedException” in IIS Express

丶灬走出姿态 提交于 2019-12-14 00:55:27

问题


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?


回答1:


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.




回答2:


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"



来源:https://stackoverflow.com/questions/23467389/state-property-of-site-throwing-notimplementedexception-in-iis-express

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!