我们有一个情况,我们需要明确限制一个网站的system.web/processModel/maxAppDomains = 1。问题是,默认情况下,只能将system.web/processModel设置为machine.config级别:
<configuration>
<configSections>
<sectionGroup name="system.web">
<section name="processModel" allowDefinition="MachineOnly" />
</sectionGroup>
</configSections>
<configuration>我知道%windir%/system32/inetsvr/appcmd.exe可以用来更新IIS设置,但是我还没有找到更新processModel节定义的allowDefinition属性的方法。有人能指出我的正确方向吗?
谢谢
发布于 2013-03-24 15:37:55
使用WMI提供程序:
' SetAllowDefinition is a static method, you should call it by getting a class object, as in the following example
Set oAnonAuth = oWebAdmin.Get("AnonymousAuthenticationSection")
oAnonAuth.SetAllowDefinition "MachineOnly"根据我的理解,我认为您在将AllowDefinition设置为AppHostOnly或MachineToApplication值时是很有兴趣的。
参考文献:http://msdn.microsoft.com/en-us/library/bb386461(v=vs.90).aspx
注意:对ProcessModelSection类的更改仅在工作进程重新启动时生效,而不是在设置更改后立即生效。
我使用下面的代码将maxAppDomain=1设置为当前的web应用程序“但是您可以通过提供路径来对任何.config文件进行更改”
System.Configuration.Configuration configuration = WebConfigurationManager.OpenWebConfiguration("");
System.Web.Configuration.ProcessModelSection processModelSection =
(ProcessModelSection)configuration.GetSection("system.web/processModel");
processModelSection.MaxAppDomains = 1;希望这是帮助,但我不得不假设两件事,因为问题的要求需要进一步澄清。
发布于 2013-03-25 23:45:21
您试过直接编辑machine.config文件吗?每次我遇到machine.config文件的问题时,我都会直接编辑该文件。
https://serverfault.com/questions/489297
复制相似问题