停止应用程序池时IIS 8.5访问被拒绝 [英] IIS 8.5 Access Denied when stopping App Pools

查看:180
本文介绍了停止应用程序池时IIS 8.5访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个将代码部署到各种目标服务器的应用程序。最近,Windows 2012服务器已添加为目标服务器,但应用程序的代理服务(在每个目标上作为服务安装)在尝试执行链接到IIS的任何任务时返回拒绝访问消息。例如,应用程序将尝试在将代码复制到目标之前停止相关的应用程序池和站点。应用程序在尝试停止应用程序池时所做的第一件事是确定需要停止哪个应用程序池,示例代码如下:



I have an application that deploys code to various target servers. Recently Windows 2012 servers have been added as target servers but the application's agent service (which is installed as a service on each target) returns an 'Access denied' message when trying to perform any tasks linked to IIS. For example the application will try to Stop the relevant App Pools and Sites before copying the code to the target. First thing the App does when trying to stop the App Pool is determine which app pool needs to be stopped, sample code below:

private const string m_adSitesPath = @"IIS://{0}/W3SVC";

private DirectoryEntry FindSite(int nPort)
    {
        using (DirectoryEntry sites = new DirectoryEntry(string.Format(m_adSitesPath, m_RemoteServerName)))
        {
            sites.RefreshCache();

            foreach (DirectoryEntry de in sites.Children)
            {
                de.RefreshCache();
                if (de.SchemaClassName == "IIsWebServer")
                {
                    string port = GetNullableDirMultiValuePart(de, "ServerBindings", 0, 1);
                    if (nPort == int.Parse(port))
                    {
                        return de; 
                    }
                }
            }
        }
        return null;
    }





应用程序在sites.RefreshCache();拒绝访问。在实际服务器上,代理以Admin组中的身份登录ID,并具有作为服务登录权限集。

在带有IIS7的Windows 2008服务器上运行时,此应用程序不显示此问题。有没有人建议我可以开始调查?它似乎是权限相关但两个服务器上的ID设置匹配所以我需要做一些IIS8吗?



谢谢



App fails at sites.RefreshCache(); with Access Denied. On the actual server the ID the Agent is logged in as is in the Admin group and has the Log on as a Service privilege set.
This application does not display this issue when running on Windows 2008 servers with IIS7. Has anyone any advice on where I could start investigating? It appears to be permissions related but the ID setup matches on both servers so is there something with IIS8 that I need to do?

Thanks

推荐答案





我相信DirectoryEntry对象中的IIS身份验证可能存在问题。你能否加入



DirectoryEntry.AuthenticationType = AuthenticationTypes.Encryption



并查看你的问题是否得到解决。



启动Windows Server 2003 SP1时,需要加密所有远程IIS通信,否则您将以WMI的WBEM_ACCESS_DENIED结束。如果此AuthenticationTypes无效,请尝试以下网页中的其他人,并告诉我它是如何运作的。



https://msdn.microsoft.com/en-us/library/system.directoryservices.authenticationtypes(v = vs.110).aspx [ ^ ]



如果问题仍然存在,请尝试使用WMI重新启动池。请参阅我的文章



http://www.codeproject.com/Tips/1063552/IIS-Application-Pool-Operations-via-sharp [ ^ ]


我通过重写方法解决了这个问题使用Microsoft.Web.Administration.dll在我打开的另一个论坛上看到这个帖子。

动态加载Microsoft.Web.Administration.dll | ASP.NET论坛
I resolved this issue by rewriting the methods using the Microsoft.Web.Administration.dll see this thread on another forum I opened.
Dynamically load Microsoft.Web.Administration.dll | The ASP.NET Forums


这篇关于停止应用程序池时IIS 8.5访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆