servermanager

ServerManager CommitChanges makes changes with a slight delay

情到浓时终转凉″ 提交于 2020-01-13 04:27:46
问题 i have a little problem with the ServerManager class (from the Microsoft.Web.Administration assembly) and i hope some of you can help me out. Basically I need to create a new application inside a site (using IIS 7.5) and redirect the user to the new application, inside the same event.This functionality is implemented inside a .net web app using mvc 3/c#. Here is my code: ServerManager iisManager = new ServerManager(); Site mySite = iisManager.Sites["mySitesName"]; ApplicationCollection

ServerManager CommitChanges makes changes with a slight delay

爱⌒轻易说出口 提交于 2020-01-13 04:27:06
问题 i have a little problem with the ServerManager class (from the Microsoft.Web.Administration assembly) and i hope some of you can help me out. Basically I need to create a new application inside a site (using IIS 7.5) and redirect the user to the new application, inside the same event.This functionality is implemented inside a .net web app using mvc 3/c#. Here is my code: ServerManager iisManager = new ServerManager(); Site mySite = iisManager.Sites["mySitesName"]; ApplicationCollection

ServerManager constructor crashes in test environment

落爺英雄遲暮 提交于 2020-01-03 07:22:09
问题 I am building a control application in MVC 4 and have encountered a really annoying problem. When I debug the project locally it works fine. However, when I deploy the project to the test server (Windows Server 2008 R2) the following line breaks: ServerManager manager = new ServerManager("%windir%\\system32\\inetsrv\\config\\applicationhost.config"); Any help is very much appreciated! Stack trace: [ArgumentNullException: Value cannot be null. Parameter name: type] System.Activator

How to determine if the “Active Directory Domain Services” role has been installed on a server

守給你的承諾、 提交于 2019-12-23 10:08:18
问题 I am trying to figure out if the Active Directory Domain Services are installed a windows server. I know they show up in the Server Manager, but can I programmatically get if the role is installed on a server using C# code 回答1: If you know the name of the server you want to test and can run the program with domain admin privileges remotely, you can use WMI: internal static bool IsDomainController(string ServerName) { StringBuilder Results = new StringBuilder(); try { ManagementObjectSearcher

COMException when trying to get application pools using ServerManager

妖精的绣舞 提交于 2019-12-22 08:42:24
问题 When I try to get the list of IIS application pools from a remote server using the following code List<ApplicationPool> appPools; using (ServerManager serverManager = ServerManager.OpenRemote("XXX")) { appPools = serverManager.ApplicationPools.ToList(); } I get an exception: System.Runtime.InteropServices.COMException (0x800706BA): Retrieving the COM class factory for remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} from machine XXX failed due to the following error:

how check if port is currently used with IIS7 (webSite) in code behind?

五迷三道 提交于 2019-12-13 13:46:43
问题 I developed a program "installer" that will add and configure a new website on IIS. My problem is that I want to check if the port given by the user is already used by another site before installing. My project is in C # WinForm style. Someone you have an idea? string[] lPorts = System.IO.Ports.SerialPort.GetPortNames(); ? 回答1: Check this: BindingInformation Property: Gets or sets the binding information for the current binding. The value of this property is a colon-delimited string that

Configure IIS authentication settings using the ServerManager class

六月ゝ 毕业季﹏ 提交于 2019-12-12 08:42:10
问题 I'm using the ServerManager class (from Microsoft.Web.Administration) to create applications on a server running IIS 7. I want to configure whether the application uses anonymous authentication or Windows-authentication on an application-basis so I can't simply ask IT to change the settings on the root site. The contents of the application belongs to a third party so I'm not allowed to change the web.config file inside the application. The Application class doesn't expose any useful

Programmatically get site status from IIS, gets back COM error

一曲冷凌霜 提交于 2019-12-09 13:20:59
问题 I am trying to programmatically get my site status from IIS to see if it's stopped, but I kept getting the following error, The object identifier does not represent a valid object. (Exception from HRESULT: 0x800710D8) The application is using ServerManager Site class to access the site status. Here is the code, //This is fine, gets back the site var serverManager = new Microsoft.Web.Administration.ServerManager(ConfigPath); var site = serverManager.Sites.FirstOrDefault(x => x.Id == 5); if

How to revert an HttpError ConfigurationElement back to “Inherited” using IIS 7 API

别等时光非礼了梦想. 提交于 2019-12-08 16:00:36
问题 Suppose I have the following <httpErrors> collection in a web.config : <httpErrors> </httpErrors> Yep, nice 'n empty. And in IIS 7, my HTTP errors page looks like this: Beautiful! (I've highlighted 404 simply because that's the example I'll use in a sec). Now, I run the following code: errorElement["statusCode"] = 404; errorElement["subStatusCode"] = -1; errorElement["path"] = "/404.html"; httpErrorsCollection.Add(errorElement); Lovely. I now have, as expected this in my web.config :

ServerManager CommitChanges makes changes with a slight delay

天大地大妈咪最大 提交于 2019-12-04 11:10:33
i have a little problem with the ServerManager class (from the Microsoft.Web.Administration assembly) and i hope some of you can help me out. Basically I need to create a new application inside a site (using IIS 7.5) and redirect the user to the new application, inside the same event.This functionality is implemented inside a .net web app using mvc 3/c#. Here is my code: ServerManager iisManager = new ServerManager(); Site mySite = iisManager.Sites["mySitesName"]; ApplicationCollection applications = mySite.Applications; Application app = applications.Add(newapp, physicalPath); app