简体   繁体   中英

BindingInformation in Microsoft.Web.Administration

I try to create new site:

    ServerManager iisManager = new ServerManager();
    Site addedSite = iisManager.Sites.Add(siteName, siteFolder, 80);
    addedSite.ServerAutoStart = true;

    iisManager.CommitChanges();

And it add site but I need to have in IIS binding information "test.com"

How can I add that ? Aslo somehow added site is stopped...

You can use the following constructor to set binding information. Found from msdn

ServerManager iisManager = new ServerManager();
Site addedSite = iisManager.Sites.Add(siteName,"http","*:80:www.example.com", siteFolder);

Where * is the server ip address that you would like to bind to the hostname www.example.com, or leave as * to catch all requests from any server ip.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM