Home Adding bindings in IIS programatically ASP.NET MVC
Reply: 0

Adding bindings in IIS programatically ASP.NET MVC

Jatin Gadhiya
1#
Jatin Gadhiya Published in 2017-12-07 12:36:12Z

I am going to adding bindings in IIS 7 using below code and it is working fine with visual studio and IIS Express.

But when I host same project in IIS 7 then it is redirecting me on login page even I am already login, and bindings also not adding.

using (ServerManager manager = new ServerManager())
{
    // Find the site by name from IIS
    Microsoft.Web.Administration.Site site = manager.Sites.Where(q => q.Name == "test").FirstOrDefault();
    site.Bindings.Add("*:81:" + "google1.com", "http");
    // Set auto start to true.
    site.ServerAutoStart = true;
    // Commit the changes
    manager.CommitChanges();        
}
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.392183 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO