IIS7 Microsoft.Web.Administration Creating application issues

Source: Internet
Author: User

When you use DirectoryEntry to manipulate IIS, you can set many properties. But when you use some of the classes in Microsoft.Web.Administration, you don't know where to set. For example: Accessscript,accessread, directory browsing, anonymous access, and other properties. I am now writing the following code:

using (servermanager SM = new Servermanager ())
{
ApplicationPool newpool = Sm. applicationpools["Newpool"];
if (Newpool = = null)
{
Newpool = Sm. Applicationpools.add ("Newpool");
Newpool.autostart = true;
Newpool.managedruntimeversion = "v4.0";
Newpool.enable32bitapponwin64 = true;
Sm.commitchanges ();
}
Site defaultsite = Sm. sites["Default Web Site"];
Application newapplication = defaultsite.applications["Newapplication"];
if (newapplication!=null)
{
DefaultSite.Applications.Remove (newapplication);
}
Newapplication = DefaultSite.Applications.Add ("/newapplication",
@ "F:\Silverlight\PrismModule\PrismModule.Web");

Newapplication.applicationpoolname = "Newpool";
Sm.commitchanges ();
}

This will also correctly create an application under the default Web site, and I would like to know how to set the properties mentioned above.

Problem solving. IIS7 The configuration information about the site is stored through the config file, which is set primarily in Applicaitonhost.config and Web. config. Use the configuration class in the Microsoft.Web.Administration

IIS7 Microsoft.Web.Administration Creating application issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.