Creating a virtual directory in IIS from classic ASP

I am working on a classic asp site that provides software as a service. A potential client of this site contacts us and we configure the site manually. We want to automate this process as much as possible. Currently, I have a form that my boss fills out to mute data in the database. This process sends me an email, and I must create the virtual directory for the site manually.

I would like to use classic ASP to install this. I do not find very good results from GIS. I found material for creating batch files or executing appcmd. Has anyone been successful with this?

Right now, our URL looks like https://www.somesite.com/CustomerName ". Later I would like to change this to something like https://CustomerName.somesite.com ." Any help in this regard would also be greatly appreciated.

+4
source share
2 answers

Overview

IIS - ASP. - COM-, ADSI WMI, . ASP.Net, Microsoft , Microsoft.Web.Administration. ( System.DirectoryServices, - ADSI.)


1 - COM ADSI

COM, . ADSI, WMI, , . ADSI , vdirs, apps ...

, , CreateNewSite():

Dim myNewSiteID, oIIsWebServiceObj, oBindings 

oBindings = Array(0) 
Set oBindings(0) = providerObj.get("ServerBinding").SpawnInstance_() 
oBindings(0).IP = "192.168.1.1" 
oBindings(0).Port = "80" 
oBindings(0).Hostname = "yournewsite.example.com"

Set oIIsWebServiceObj = GetObject("IIS://MachineName/W3SVC")
myNewSiteID = oIIsWebServiceObj.CreateNewSite("NewSite", oBindings, _
       "C:\Sites\yournewsite")

, :

Dim IIsWebVDirRootObj, IIsWebVDirObj
Set IIsWebVDirRootObj = GetObject("IIS://localhost/W3SVC/1/Root") 
Set IIsWebVDirObj = IIsWebVDirRootObj.Create("IIsWebVirtualDir", "NewVDir") 
IIsWebVDirObj.Put "Path", "C:\NewContent"  
IIsWebVDirObj.Put "AccessRead", True 
IIsWebVDirObj.Put "AccessScript", True 
IIsWebVDirObj.SetInfo

95% , ADSI WMI IIS6, COM- , IIS . IIS6, . MSDN IIS 7.5 MSDN IIS8.


2 -.Net Microsoft.Web.Administration

.Net, Microsoft.Web.Administration System.DirectoryServices. , .Net , , asp, .Net. , CCW - COM-Callable Wrapper. , .Net COM-, .Net. , .net CCW, CCW'd.Net , :

ServerManager serverManager = new ServerManager();
Site mySite = serverManager.Sites.Add("NewSite", "C:\\Sites\\yournewsite", 80);
mySite.ServerAutoStart = true;
serverManager.CommitChanges();

, CCW, . MSDN.


... .

, : IUSR, IUSR_MachineName, - , IIS. , . asp, - . , , , , IUSR.

Basic Auth. , , .

+3

:

  • (, /) / /.
  • System.DirectoryServices apis / . this, , / / IIS6.
  • IIS7, / /.
+1

Source: https://habr.com/ru/post/1570401/


All Articles