It is currently Sun Jun 16, 2019 5:48 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: PB.Ex IIS (Windows)
PostPosted: Wed May 15, 2019 2:52 pm 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 956
Location: Germany::Berlin()
Hello

With this library you can automatically create, configure, start and stop web sites and application pools for your own IIS web server without RunProgram().

Functions:
    CreateIISSite()
    • Syntax:
      Code:
      Result = CreateIISSite(SiteName$, Protocol, IPAddress$, Port, Domain$, Path$, ApplicationPool$, @ErrorOutput$)

    • Description: Creates a new website.
    • Parameter:
      1. SiteName$: The name of the website.
      2. Protocol: Protocol of the website. The following constants can be used:
        • #PBEx_IIS_Protocol_HTTP
        • #PBEx_IIS_Protocol_HTTPS
      3. IPAddress$: IP address of the network card. "*" or "" can be passed if the domain is not to be bound to a specific network card.
      4. Port: The port number.
      5. Domain$: The domain address.
      6. Path$: The complete physical path to the directory where the Web site is located.
      7. ApplicationPool$: The name of an existing application pool.
      8. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    • Example:
      Code:
      EnableExplicit

      Global PBEx_IIS

      #PBEx_IIS_Protocol_HTTP = 0
      #PBEx_IIS_Protocol_HTTPS = 1
      #PBEx_IIS_Attribute_Site_ApplicationPool = 1
      #PBEx_IIS_Attribute_Site_Path = 2
      #PBEx_IIS_Attribute_Site_ConnectionTimeout = 3
      #PBEx_IIS_Attribute_Site_MaxBandwidth = 4
      #PBEx_IIS_Attribute_Site_MaxConnections = 5
      #PBEx_IIS_Attribute_Site_MaxUrlSegments = 6
      #PBEx_IIS_Attribute_ApplicationPool_AutoStart = 1
      #PBEx_IIS_Attribute_ApplicationPool_Enable32BitAppOnWin64 = 2
      #PBEx_IIS_Attribute_ApplicationPool_ManagedPipelineMode = 3
      #PBEx_IIS_Attribute_ApplicationPool_ManagedRuntimeVersion = 4
      #PBEx_IIS_Attribute_ApplicationPool_QueueLength = 5
      #PBEx_IIS_Attribute_ApplicationPool_StartMode = 6

      CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
        PBEx_IIS = OpenLibrary(#PB_Any, "PB.Ex_IIS_x86.dll")
      CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
        PBEx_IIS = OpenLibrary(#PB_Any, "PB.Ex_IIS_x64.dll")
      CompilerEndIf

      If PBEx_IIS
        Prototype CreateIISSite(SiteName.p-Unicode, Protocol, IPAddress.p-Unicode, Port, Domain.p-Unicode, Path.p-Unicode, ApplicationPool.p-Unicode, ErrorOutput)
        Global CreateIISSite.CreateIISSite = GetFunction(PBEx_IIS, "CreateIISSite")
        Prototype DeleteIISSite(SiteName.p-Unicode, ErrorOutput)
        Global DeleteIISSite.DeleteIISSite = GetFunction(PBEx_IIS, "DeleteIISSite")
        Prototype StartIISSite(SiteName.p-Unicode, ErrorOutput)
        Global StartIISSite.StartIISSite = GetFunction(PBEx_IIS, "StartIISSite")
        Prototype StopIISSite(SiteName.p-Unicode, ErrorOutput)
        Global StopIISSite.StopIISSite = GetFunction(PBEx_IIS, "StopIISSite")
        Prototype ExamineIISSite(ErrorOutput)
        Global ExamineIISSite.ExamineIISSite = GetFunction(PBEx_IIS, "ExamineIISSite")
        Prototype NextIISSiteEntry(ErrorOutput)
        Global NextIISSiteEntry.NextIISSiteEntry = GetFunction(PBEx_IIS, "NextIISSiteEntry")
        Prototype IISSiteEntryName(Output, ErrorOutput)
        Global IISSiteEntryName.IISSiteEntryName = GetFunction(PBEx_IIS, "IISSiteEntryName")
        Prototype FinishIISSite(ErrorOutput)
        Global FinishIISSite.FinishIISSite = GetFunction(PBEx_IIS, "FinishIISSite")
        Prototype CreateIISApplicationPool(ApplicationPoolName.p-Unicode, ErrorOutput)
        Global CreateIISApplicationPool.CreateIISApplicationPool = GetFunction(PBEx_IIS, "CreateIISApplicationPool")
        Prototype DeleteIISApplicationPool(ApplicationPoolName.p-Unicode, ErrorOutput)
        Global DeleteIISApplicationPool.DeleteIISApplicationPool = GetFunction(PBEx_IIS, "DeleteIISApplicationPool")
        Prototype StartIISApplicationPool(ApplicationPoolName.p-Unicode, ErrorOutput)
        Global StartIISApplicationPool.StartIISApplicationPool = GetFunction(PBEx_IIS, "StartIISApplicationPool")
        Prototype StopIISApplicationPool(ApplicationPoolName.p-Unicode, ErrorOutput)
        Global StopIISApplicationPool.StopIISApplicationPool = GetFunction(PBEx_IIS, "StopIISApplicationPool")
        Prototype ExamineIISApplicationPool(ErrorOutput)
        Global ExamineIISApplicationPool.ExamineIISApplicationPool = GetFunction(PBEx_IIS, "ExamineIISApplicationPool")
        Prototype NextIISApplicationPoolEntry(ErrorOutput)
        Global NextIISApplicationPoolEntry.NextIISApplicationPoolEntry = GetFunction(PBEx_IIS, "NextIISApplicationPoolEntry")
        Prototype IISApplicationPoolEntryName(Output, ErrorOutput)
        Global IISApplicationPoolEntryName.IISApplicationPoolEntryName = GetFunction(PBEx_IIS, "IISApplicationPoolEntryName")
        Prototype FinishIISApplicationPool(ErrorOutput)
        Global FinishIISApplicationPool.FinishIISApplicationPool = GetFunction(PBEx_IIS, "FinishIISApplicationPool")
        Prototype SetIISSiteAttribute(SiteName.p-Unicode, Attribute, Value.p-Unicode, ErrorOutput)
        Global SetIISSiteAttribute.SetIISSiteAttribute = GetFunction(PBEx_IIS, "SetIISSiteAttribute")
        Prototype GetIISSiteAttribute(SiteName.p-Unicode, Attribute, Output, ErrorOutput)
        Global GetIISSiteAttribute.GetIISSiteAttribute = GetFunction(PBEx_IIS, "GetIISSiteAttribute")
        Prototype SetIISApplicationPoolAttribute(ApplicationPoolName.p-Unicode, Attribute, Value.p-Unicode, ErrorOutput)
        Global SetIISApplicationPoolAttribute.SetIISApplicationPoolAttribute = GetFunction(PBEx_IIS, "SetIISApplicationPoolAttribute")
        Prototype GetIISApplicationPoolAttribute(ApplicationPoolName.p-Unicode, Attribute, Output, ErrorOutput)
        Global GetIISApplicationPoolAttribute.GetIISApplicationPoolAttribute = GetFunction(PBEx_IIS, "GetIISApplicationPoolAttribute")
       
      EndIf

      Global Output$ = Space(1024)
      Global ErrorOutput$ = Space(128)

      ;CreateIISApplicationPool("MyOwnAppPool", @ErrorOutput$)
      ;DeleteIISApplicationPool("MyOwnAppPool", @ErrorOutput$)

      ;CreateIISSite("MyOwnSite", #PBEx_IIS_Protocol_HTTP, "", 81, "localhost", "D:\ht-docs\", "DefaultAppPool", @ErrorOutput$)
      ;DeleteIISSite("MyOwnSite", @ErrorOutput$)

      ;List all application pool
      Debug "Application pools:"
      If ExamineIISApplicationPool(@ErrorOutput$)
        While NextIISApplicationPoolEntry(@ErrorOutput$)
          IISApplicationPoolEntryName(@Output$, @ErrorOutput$)
          Debug Output$
        Wend
      EndIf

      ;List all web sites
      Debug "Web sites:"
      If ExamineIISSite(@ErrorOutput$)
        While NextIISSiteEntry(@ErrorOutput$)
          IISSiteEntryName(@Output$, @ErrorOutput$)
          Debug Output$
        Wend
      EndIf

      CloseLibrary(PBEx_IIS)

    DeleteIISSite()
    • Syntax:
      Code:
      Result = DeleteIISSite(SiteName$, @ErrorOutput$)

    • Description: Removes an existing website. Before deleting, the specified website is closed. If client connections to this site still exist, it may take a few seconds for all open connections to be released from the web server.
    • Parameter:
      1. SiteName$: The name of an existing website.
      2. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    StartIISSite()
    • Syntax:
      Code:
      Result = StartIISSite(SiteName$, @ErrorOutput$)

    • Description: Starts an existing website.
    • Parameter:
      1. SiteName$: The name of an existing website.
      2. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    StopIISSite()
    • Syntax:
      Code:
      Result = StopIISSite(SiteName$, @ErrorOutput$)

    • Description: Ends an existing website. If client connections to this site still exist, it may take a few seconds for all open connections to be released from the web server.
    • Parameter:
      1. SiteName$: The name of an existing website.
      2. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    ExamineIISSite()
    • Syntax:
      Code:
      Result = ExamineIISSite(@ErrorOutput$)

    • Description: Starts a list of all existing websites.
    • Parameter:
      1. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    NextIISSiteEntry()
    • Syntax:
      Code:
      Result = NextIISSiteEntry(@ErrorOutput$)

    • Description: The next website in the list is determined. This function is only valid within the ExamineIISSite loop.
    • Parameter:
      1. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    IISSiteEntryName()
    • Syntax:
      Code:
      Result = IISSiteEntryName(@Output$, @ErrorOutput$)

    • Description: The name of the website is determined. This function is only valid within the ExamineIISSite loop.
    • Parameter:
      1. @Output$: The name of the website is stored in this variable.
      2. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    FinishIISSite()
    • Syntax:
      Code:
      Result = FinishIISSite(@ErrorOutput$)

    • Description: Closes the listing.
    • Parameter:
      1. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    SetIISSiteAttribute()
    • Syntax:
      Code:
      Result = SetIISSiteAttribute(SiteName$, Attribute, Value$, @ErrorOutput$)

    • Description: Changes the value of the specified attribute.
    • Parameter:
      1. SiteName$: The name of an existing website.
      2. Attribute: The following constants can be used:
        • #PBEx_IIS_Attribute_Site_ApplicationPool
        • #PBEx_IIS_Attribute_Site_Path
        • #PBEx_IIS_Attribute_Site_ConnectionTimeout
        • #PBEx_IIS_Attribute_Site_MaxBandwidth
        • #PBEx_IIS_Attribute_Site_MaxConnections
        • #PBEx_IIS_Attribute_Site_MaxUrlSegments
      3. Value$: The value for the change.
      4. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    GetIISSiteAttribute()
    • Syntax:
      Code:
      Result = GetIISSiteAttribute(SiteName$, Attribute, @Output$, @ErrorOutput$)

    • Description: Determines the value using the attribute.
    • Parameter:
      1. SiteName$: The name of an existing website.
      2. Attribute: The following constants can be queried:
        • #PBEx_IIS_Attribute_Site_ApplicationPool
        • #PBEx_IIS_Attribute_Site_Path
        • #PBEx_IIS_Attribute_Site_ConnectionTimeout
        • #PBEx_IIS_Attribute_Site_MaxBandwidth
        • #PBEx_IIS_Attribute_Site_MaxConnections
        • #PBEx_IIS_Attribute_Site_MaxUrlSegments
      3. @Output$: The value is stored in this variable.
      4. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    CreateIISApplicationPool()
    • Syntax:
      Code:
      Result = CreateIISApplicationPool(ApplicationPoolName$, @ErrorOutput$)

    • Description: Creates a new application pool.
    • Parameter:
      1. ApplicationPoolName$: The name of the application pool.
      2. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    DeleteIISApplicationPool()
    • Syntax:
      Code:
      Result = DeleteIISApplicationPool(ApplicationPoolName$, @ErrorOutput$)

    • Description: Removes an existing application pool.
    • Parameter:
      1. ApplicationPoolName$: The name of the existing application pool.
      2. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    StartIISApplicationPool()
    • Syntax:
      Code:
      Result = StartIISApplicationPool(ApplicationPoolName$, @ErrorOutput$)

    • Description: Starts an existing application pool.
    • Parameter:
      1. ApplicationPoolName$: The name of the existing application pool.
      2. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    StopIISApplicationPool()
    • Syntax:
      Code:
      Result = StopIISApplicationPool(ApplicationPoolName$, @ErrorOutput$)

    • Description: Terminates an existing application pool.
    • Parameter:
      1. ApplicationPoolName$: The name of the existing application pool.
      2. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    ExamineIISApplicationPool()
    • Syntax:
      Code:
      Result = ExamineIISApplicationPool(@ErrorOutput$)

    • Description: Starts a list of all existing application pools.
    • Parameter:
      1. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    NextIISApplicationPoolEntry()
    • Syntax:
      Code:
      Result = NextIISApplicationPoolEntry(@ErrorOutput$)

    • Description: The next application pool in the list is determined. This function is only valid within the ExamineIISApplicationPool loop.
    • Parameter:
      1. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    IISApplicationPoolEntryName()
    • Syntax:
      Code:
      Result = IISApplicationPoolEntryName(@Output$, @ErrorOutput$)

    • Description: The name of the application pool is determined. This function is only valid within the ExamineIISApplicationPool loop.
    • Parameter:
      1. @Output$: The name of the application pool is stored in this variable.
      2. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    FinishIISApplicationPool()
    • Syntax:
      Code:
      Result = FinishIISApplicationPool(@ErrorOutput$)

    • Description: Closes the listing.
    • Parameter:
      1. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    SetIISApplicationPoolAttribute()
    • Syntax:
      Code:
      Result = SetIISApplicationPoolAttribute(ApplicationPoolName$, Attribute, Value$, @ErrorOutput$)

    • Description: Changes the value of the specified attribute.
    • Parameter:
      1. ApplicationPoolName$: The name of the existing application pool.
      2. Attribute: The following constants can be used:
        • #PBEx_IIS_Attribute_ApplicationPool_AutoStart
        • #PBEx_IIS_Attribute_ApplicationPool_Enable32BitAppOnWin64
        • #PBEx_IIS_Attribute_ApplicationPool_ManagedPipelineMode: Integrated, Classic
        • #PBEx_IIS_Attribute_ApplicationPool_ManagedRuntimeVersion
        • #PBEx_IIS_Attribute_ApplicationPool_QueueLength
        • #PBEx_IIS_Attribute_ApplicationPool_StartMode: OnDemand, AlwaysRunning
      3. Value$: The value for the change.
      4. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.
    GetIISApplicationPoolAttribute()
    • Syntax:
      Code:
      Result = GetIISApplicationPoolAttribute(ApplicationPoolName$, Attribute, @Output$, @ErrorOutput$)

    • Description: Determines the value using the attribute.
    • Parameter:
      1. ApplicationPoolName$: The name of the existing application pool.
      2. Attribute: The following constants can be queried:
        • #PBEx_IIS_Attribute_ApplicationPool_AutoStart
        • #PBEx_IIS_Attribute_ApplicationPool_Enable32BitAppOnWin64
        • #PBEx_IIS_Attribute_ApplicationPool_ManagedPipelineMode: Integrated, Classic
        • #PBEx_IIS_Attribute_ApplicationPool_ManagedRuntimeVersion
        • #PBEx_IIS_Attribute_ApplicationPool_QueueLength
        • #PBEx_IIS_Attribute_ApplicationPool_StartMode: OnDemand, AlwaysRunning
      3. @Output$: The value is stored in this variable.
      4. @ErrorOutput$: If an error occurred, the error message is stored in the variable. This variable must be reserved with 128 characters before passing. Maximum return length is 128 characters including the NULL character. If no error description is to be returned for an error, 0 can be passed instead.
    • Return value:
      • 1: The process was successful.

System requirements:
  • Windows Vista or higher
  • .NET Framework 4.5 or higher
  • IIS
  • Unicode activation (default from PB 5.50)
  • Administrator privileges

License: This DLL file is free of charge and may be used both privately and commercially.

Download: http://www.rsbasic.de/downloads/downloa ... Ex_IIS.zip
Image

I would be very pleased about feedbacks, improvement suggestions, error messages or wishes. If you want to support me, you can also donate something. Thanks :)

_________________
ImageImageImageImageImage


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye