dcsimg
Results 1 to 14 of 14

Thread: VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,786

    VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

    As the title says, one can configure the IIS (the MS-WebServer-Instance that comes with each Win-Installation)
    in a way, that allows convenient roundtrip-debugging of serverside code, when it is contained in an AX-Dll-Project.

    For that, one has to setup the VB6-IDE, to load and run a VB6-ProjectGroup (defined in a *.vbg-File) -
    but more on that later...

    First, to the setup of a *local* (on your Dev-Machine) running IIS-instance, to make that possible...

    The following assumes that you already *have* installed a Dev-machine-local IIS-instance (over Programs-and-Features),
    and didn't forget to check-in the support for "classic-ASP" in the Install-Options (which is a requirement).

    Now, what's needed in addition, to make interaction with the (32Bit-) Dll-Binaries of VB6 possible,
    can be done by changing a few DefaultAppPool-settings in the IIS-Manager
    (which one can find either in the StartMenu, or by explicitely starting it from (usually) C:\WINDOWS\system32\inetsrv\IIS.msc )

    Once the InetMgr was started up,
    - select (in the TreeView to the Left) the ApplicationPools-Entry
    - followed by right-clicking (in the main-area of the Dialog) the DefaultAppPool
    - choose the "Extended Settings"-entry from the Menu


    Now you will have to change two things in the upcoming Dialog:
    - activate the "32Bit-Ness" of the AppPool (it's one of the Top-Entries)
    - then set your own User-Identity (the credentials you use also for your Windows-Login) as the one, the AppPool-Process shall run under

    Press OK in the Dialog.


    Ok, what now remains is, to tell the IIS-instance, to use that new AppPool-Identity as the Default-Auth-mechanism for anonymous requests:
    - select (in the TreeView to the Left) the Root-Entry
    - doubleclick the Authentication-Icon in the main-area


    - now right click "Anonymous Authentication" in the main-area
    - and select "Edit" in the Context-Menu


    - now choose "Identity of the Application-Pool" in the upcoming Dialog

    Press OK in the Dialog.

    Now restart the IIS-instance (on the restart-links on the right-hand-side) -
    and we are all set to continue with the VB6-IDE (the configuration of the debuggable ProjectGroup).

    ... to be continued ...

    Olaf
    Last edited by Schmidt; Sep 29th, 2018 at 10:54 AM.

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    19,153

    Re: VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

    It may be worth noting that when you install IIS with ASP support the process completes the installation of VB6 components. This allows you to create a new IIS Application Project.

    You'll want to follow the configration steps given above to make this work properly in IIS. I haven't tried a Make (build) yet or tried a debugging session but all of the pieces seem to be in place even on Windows 10 (IIS 10).


    A downside of IIS Applications (WebClasses) is that adoption was slow, much as you still find people using VB5's DAO today. When ASP.Net took this concept Microsoft started saying WebClasses were no longer supported... though it is starting to look as if they may still work fine.

    But as a result there were never a lot of 3rd party published samples or tutorials of any substance. You need to take the original Microsoft VB6 class (rare now, and costly) or else crack the books from that era and the VB6 documentation from the October 2001 edition of the MSDN Library CDs.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,786

    Re: VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

    I should perhaps mention (since dile brought that up), that this thread is *not* trying to explain, how the "WebClasses"-ProjectType of VB6 will work
    (which was primarily used, to ease the development of dynamic WebPages for Browser-Clients).

    Instead this series will focus on, how a "full-blown and rich VB6-Desktop-Client-App" can be developed,
    which uses the IIS only as a plain (non HTML-delivering) Application-Server...

    The http-based RPCs we will set-up now, are merely an elegant means, to transport "arbitrary binary data" back and forth -
    whilst communicating with such an AppServer-Instance in an easy (and debuggable) manner ...
    (by wrapping-up a debuggable "ServerLib.dll"-Project in a VB6-ProjectGroup, together with a normal StdExe-ClientProject).

    Ok, here the first - and very "bare bones" - Demo-Zip:
    RPCTest_Simple.zip

    Please unzip its contents into a Development-Folder of your choice
    (on the same machine, you've previously set-up the IIS-instance - as described in the Opener-Post).

    ASP-Delegator-Script:

    After Unzipping, please ensure the following first:
    - move the ServerLib.asp File in the Zips Root-Folder into your local: C:\inetpub\wwwroot\asp\ Folder

    This script-file is pretty small, and contains the following:
    Code:
    <% @EnableSessionState=False %>
    
    <%
       On Error Resume Next
          Server.CreateObject("ServerLib.cASP").HandleRequest Application, Server, Request, Response
       If Err Then Response.Write "Error: " & Err.Description
    %>
    As for an explanation of the above...:
    - the first line (EnableSessionState=False) will suppress unnecessary Session-Handling-efforts on the side of the IIS (and also suppresses "client-side cookie-writing").
    - the following Block is just an "InPlace-Error-handled Instancing-Call into a COM-Dll
    ...using the ProgID "ServerLib.cASP" (which is exactly the Naming-Scheme of the AX-Dll and -Class that is contained in our VB6-Project).
    ...and the HandleRequest MethodCall just passes 4 IIS-Context-Objects along (Application, Server, Request, Response )

    Note, that this ASP-Script is the only thing you'd ever have to write "Script-Code-Wise" to make all the stuff which now follows, work -
    we will never (in the context of this series) come into contact with ASP-Scripting again (all the rest of the serverside-handler-code will be VB6-Code).

    VB6-Project-Startup and -Description:


    Now (after placing the little ASP-Delegator-Script in the IIS-asp-Folder), one can proceed by starting the VB6-ProjectGroup:
    - by DoubleClicking the _ASPTest.vbg File from within the Demos Root-Folder...

    The upstarted Project-Group contains (in sum) only about 30 lines of code - and the Project-Tree of that Group should look like that:


    - the RPCTest ProjectTree-entry above (our StdExe-Client) is the "Default-Project" the Group uses when starting up
    - and the ServerLib ProjectTree-entry (our AX-Dll-Profject) contains the Code which runs on the serverside

    Note, that you do *not* have to compile neither the AX-Dll-Project, nor the StdExe-Project -
    the whole thing (when the IIS was set-up properly beforehand) should work "out-of-the-box"...

    Testing the RoundTrip:

    To test the RPC-Roundtrip, please enter the cASP Class-Module-Code and place a BreakPoint in its "HandleRequest"-Method:
    Code:
    Option Explicit
    
    Public Sub HandleRequest(Application As Object, Server As Object, Request As Object, Response As Object)
      Response.Write "Hello World" 'place a BreakPoint here, to see the RoundTrip-Debugging in action
    End Sub
    Now run the ProjectGroup - and click the Form (which triggers the RPC) -
    if your VB6-IDE now stops the execution within the HandleRequest-method, we've successfully completed Step 1 in this little tutorial...
    (just let it run further with <F5> - or use the <F8> to see, where you come-out, when the HandleRequest-Method is exited).

    Olaf
    Last edited by Schmidt; Oct 1st, 2018 at 12:56 PM.

  4. #4
    Lively Member Peekay's Avatar
    Join Date
    Sep 2006
    Location
    Witbank, South Africa
    Posts
    123

    Re: VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

    Hi Olaf,

    I cannot download and/or open the RPCtest_simple zip file. Can you just check please.

    PK

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,786

    Re: VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

    Quote Originally Posted by Peekay View Post
    I cannot download and/or open the RPCtest_simple zip file. Can you just check please.
    I've just done that - and it works without problems here... (when the VBForums-DL-Link is clicked from within an "up-to-date Mozilla-FireFox").
    Not sure, why you cannot download it (and it seems that it was downloaded by other Users already more than 10 times, quite sure someone would have complained, if there was something not working).

    What Browser are you using (perhaps switch to a different one - and try again)?

    FWIW, I've put the Zip also on my own WebServer here: http://vbRichClient.com/Downloads/RPCTest_Simple.zip

    Olaf

  6. #6
    Lively Member Peekay's Avatar
    Join Date
    Sep 2006
    Location
    Witbank, South Africa
    Posts
    123

    Re: VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

    Hi Olaf,
    It worked in Chrome and not in IE11.
    I have downloaded the program group and mine works. Its incredible!
    PK

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,786

    Re: VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

    Quote Originally Posted by Peekay View Post
    I have downloaded the program group and mine works. Its incredible!
    Ah, good to know...

    Then let's proceed with Part2 of the Code-Demos (now addressing Parameter- and ReturnValue-Transport in the RPCs).
    Here's the Demo-Code:
    RPCTest_WithParams.zip

    It will behave in the same way as the first, simpler Demo - also requiring no compilation - just the Startup of the _AspTest.vbg
    (but please make sure, that a potentially still running IDE-instance of a previous AspTest-ProjectGroups is closed, before you start the new ProjectGroup).

    Parameter- and ReturnValue-Transport in RPCs:

    In Browser-Apps (which use JavaScript in conjunction with "Ajax" to perform the same kind of http-RPCs),
    the Parameter- and ReturnValues are transported via "serialized JavaScript-ObjectContainers" (JSON).

    Now, in VB6 we could use JSON-serialization via appropriate support-classes as well -
    but since the "main-work" of the whole Remote-Layer will later be focused on "interaction with a serverside DB in a Rich-VB6-Client-App",
    we can as well use a Container-Type, which supports these DB-related tasks already, but "normal, non-DB-related tasks" as well -
    so, what I'm talking about is obviously a (disconnected) ADO-Recordset.

    Since an ADO-Rs can:
    - also be created "standalone" (without any DB-relations)
    - can contain multiple Params in different DataTypes (in several, appropriately typed Fields)
    - and already supports a binary-serialization-format with low size-overhead (over its Rs.Save-Method)
    it is an ideal candidate for our task of "Parameter- and ReturnValue-transport"...

    So this second Demo now comes:
    - with a *.bas-Module that contains ADO-Rs-serialization-HelperRoutines
    - and a slightly changed DoRPC-method (in cRPC) - its Function-signature now looking this way:
    Code:
    Public Function DoRPC(ProcName As String, ParamArray P()) As Recordset
    So our DoRPC-routine now expects the User to pass on:
    - a serverside ProcedureName
    - followed by a ParameterList of arbitrary length (any of the simpler Variant-Types are supported, including ByteArrays).

    Here's what this second Demo now contains in the Form_Click-EventHandler:
    Code:
    Private Sub Form_Click()
      Dim RsResult As ADODB.Recordset
      Set RsResult = RPC.DoRPC("GetServerTime") 'Demo-Call with no Parameters
    '  Set RsResult = RPC.DoRPC("ReflectString", "ABC") 'Demo-Call with 1 Parameter
    '  Set RsResult = RPC.DoRPC("AddNumbers", 1.5, 2) 'Demo-Call with 2 Parameters
    '  Set RsResult = RPC.DoRPC("AddNumbersReflectAndTime", 1.5, 2, "ABC") 'get multiple Results in one single RPC-RoundTrip
    '  Set RsResult = RPC.DoRPC("DivideNumbers", 1, 0)  '<- we pass 0 as the second arg, to show how serverside errors are transported
       
      VisualizeRs RsResult
    End Sub
    So, the usage should be quite obvious - and I recommend to try out each of the example-calls
    (commenting lines in- and out appropriately), then stepping through them, to get a better feel for the whole thing).

    As one can see, the ReturnValue(s) will always be transported in an ADO-Rs (also in case of an encountered Error along the way) -
    so an MSHFlexGrid was choosen to visualize these returned Results (but one can of course also access the return-values in a "non-visual-way", direclty from the RsResult).

    As said, play around with it for some time (including implementing your own serverside routines in the cHandler-Class, addressing those as well from the clientside Form-Project).

    In the next Demo we will "get serious" (based on these Rs-based Transports) - and address a serverside DB...

    Olaf
    Last edited by Schmidt; Oct 1st, 2018 at 01:00 PM.

  8. #8
    Lively Member
    Join Date
    Aug 2016
    Posts
    111

    Re: VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

    What is the windows configurations for IIS? Refer to the screenshot.
    Attached Images Attached Images  

  9. #9
    Lively Member Peekay's Avatar
    Join Date
    Sep 2006
    Location
    Witbank, South Africa
    Posts
    123

    Re: VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

    Hi Olaf,
    I have worked through the #7 exercise and I think I am ready for the next.
    Thanks
    PK

  10. #10

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,786

    Re: VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

    Quote Originally Posted by DaveDavis View Post
    What is the windows configurations for IIS? Refer to the screenshot.
    Checking the "IIS Management-Concole" should be enough...

    On Win10 you will then find the InetMgr-App when you go over your:
    <Control-Panel>... and there doubleclick on<Management>... one of the Icons within the Management-Window should be associated with the IIS-Mgr.

    (the above terms were translated from a german OS, where they are named: <System-Steuerung><Verwaltung>...).

    HTH

    Olaf

  11. #11
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    32,504

    Re: VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

    I'm afraid I had to remove the link from the first post, as it contained compiled code. While we don't expect that there is anything harmful in it, and it seemed like a pretty useful addition, the policy is pretty clear: We can't say anything about compiled code, including whether or not it is what it says it is, so it is not allowed in this forum.

    As to the second link. That doesn't even appear to be working, so I left it, because it may or may not even exist.
    My usual boring signature: Nothing

  12. #12
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    32,504

    Re: VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

    I'm afraid I had to remove the link from the first post, as it contained compiled code. While we don't expect that there is anything harmful in it, and it seemed like a pretty useful addition, the policy is pretty clear: We can't say anything about compiled code, including whether or not it is what it says it is, so it is not allowed in this forum.

    As to the second link. That doesn't even appear to be working, so I left it, because it may or may not even exist.
    My usual boring signature: Nothing

  13. #13

    Thread Starter
    PowerPoster
    Join Date
    Jun 2013
    Posts
    3,786

    Re: VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

    Quote Originally Posted by Shaggy Hiker View Post
    I'm afraid I had to remove the link from the first post,...
    Have changed the BinComp-File to a plain *.tlb now (in both Zips) - let's see whether that helps.

    Olaf

  14. #14
    Fanatic Member wqweto's Avatar
    Join Date
    May 2011
    Posts
    747

    Re: VB6 IIS-Configuration for RoundTrip-Debugging of http-RPCs

    The .tlb can be a target for Project Compatibility only as in attached samples.

    For Binary Compatibility one can expect to get A compatible ActiveX component must be a Visual Basic executable error -- bummer!

    cheers,
    </wqw>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width