首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >利用IIS托管的asp.net开发网站监控工具

利用IIS托管的asp.net开发网站监控工具
EN

Stack Overflow用户
提问于 2022-10-27 14:09:34
回答 1查看 78关注 0票数 0

我们计划开发一个asp.net网站来监控托管在IIS服务器上的网站。

基本上,我们想知道网站是否已经启动和运行,性能如何,以及是否出现了故障。

有什么方法可以用asp.net来开发吗?

我们可以使用哪些服务来获得状态?

我们不会在市场上寻找任何监测产品。

EN

回答 1

Stack Overflow用户

发布于 2022-10-27 17:10:07

使用Microsoft.Web.Administration,这几乎是可能的。

下面是一些看起来与您所描述的相匹配的用例示例:

代码语言:javascript
复制
    ServerManager server = new ServerManager();
     
    SiteCollection sites = server.Sites;
    foreach (Site site in sites)
    {
        ApplicationDefaults defaults = site.ApplicationDefaults;
     
        //get the name of the ApplicationPool under which the Site runs
        string appPoolName = defaults.ApplicationPoolName;
     
        ConfigurationAttributeCollection attributes =  defaults.Attributes;
        foreach (ConfigurationAttribute configAttribute in attributes)
        {
            //put code here to work with each ConfigurationAttribute
        }
     
        ConfigurationAttributeCollection attributesCollection = site.Attributes;
        foreach (ConfigurationAttribute attribute in attributesCollection)
        {
            //put code here to work with each ConfigurationAttribute
        }
     
        //Get the Binding objects for this Site
        BindingCollection bindings = site.Bindings;
        foreach (Microsoft.Web.Administration.Binding binding in bindings)
        {
            //put code here to work with each Binding
        }
     
        //retrieve the State of the Site
        ObjectState siteState = site.State;
     
        //Get the list of all Applications for this Site
        ApplicationCollection applications = site.Applications;
        foreach (Microsoft.Web.Administration.Application application in applications)
        {
            //put code here to work with each Application
        }
    }

来源

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74223487

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档