Quantcast
Channel: Configuration & Scripting
Viewing all articles
Browse latest Browse all 780

ApplicationHost not showing new Website

$
0
0

Hi,

I am using VB.Net to create a new Web Site,  Code is -

@Imports System
@Imports Microsoft.Web.Administration
@Imports System.Text

PrivateSubNew_Site()dimserverMgrAsServerManager=newServerManager()dimmySiteAsSite=serverMgr.Sites.Add("Example","C:\\Program Files (x86)\\Enigma Systems\\Example",20101)serverMgr.ApplicationPools.Add("ExamplePool")mySite.ApplicationDefaults.ApplicationPoolName="Example Pool"mySite.TraceFailedRequestsLogging.Enabled=truemySite.TraceFailedRequestsLogging.Directory="C:\\inetpub\\customfolder\\site"serverMgr.CommitChanges()EndSubPrivateSubRemove_Site()dimserverMgrAsServerManager=newServerManager()Trydims1asSite=serverMgr.Sites("Example")' you can pass the site name or the site IDTrydima1asApplicationPool=serverMgr.ApplicationPools("ExamplePool")' you can pass the site name or the site IDserverMgr.ApplicationPools.Remove(a1)CatchEndtryserverMgr.Sites.Remove(s1)serverMgr.CommitChanges()CatchEndtryEndSub
New_Site will set a site because if it is run twice the second run has error saying no duplicate of 
Example name is alloqwed. Remove_Site will do that and let New_Site run again. So the Site exists.
But does not show when displaying ApplicationHost.config details.
The VB,Net code is a translation from the C# example in
https://blogs.msdn.microsoft.com/rakkimk/2007/06/08/iis7-sample-code-for-addingdeleting-a-website-programmatically-c-example/
Anyone know what is going wrong.? I have been researching for days with no luck!

Viewing all articles
Browse latest Browse all 780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>