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

Adding bindings in IIS programatically ASP.NET MVC

user686 Published in July 16, 2018, 6:44 am

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
You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO