NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: jking on May 15, 2022, 04:39:37 PM

Title: Multi-Site host and NT 12.41 issue
Post by: jking on May 15, 2022, 04:39:37 PM
Hi Bruce,

     I recently began updating a series of NT apps to NT 12.41.  Each of these runs in the Multi-Site host, also updated to NT 12.41.  The apps began in NT 11 and were moved to NT 12.19, were they all worked as expected for about a year. 
     Now that I have them in NT 12.41, two apps are giving me trouble.  They are looking for files in the Host folder, not the specific app folder.  In the WebHandler, ProcessLink embed, I have the following:

      Demo{prop:name} = clip(self.site.appPath) & 'Demo.tps'
      Users{prop:name} = clip(self.site.appPath) & 'Users.tps'

It does seem to find the Demo.tps file in the app folder but always looks for the Users.tps file in the Host folder.  I know this because the create attribute is set in the dictionary and the Users.tps file is always created in the Host folder.  There are two other similar apps that work as expected.  Any thoughts on this?

Thanks,

Jeff King

Title: Re: Multi-Site host and NT 12.41 issue
Post by: Bruce on May 15, 2022, 10:55:53 PM
Perhaps there's another clue?
In the Host setup, for each server, there's a "data path" setting.
What is this set to, for the ones that work ok, and the ones that don't?

And I suppose, since you are using appPath, what is the appPath set to?
I'd be inclined to have your code use self.site.datapath not self.site.apppath

Also, the current recommendation is to put all the DLL's in the same folder as the Host.Exe - (and every DLL your DLL uses _has_ to be in the Host exe folder) - so in that context separating datapath and app path becomes even more significant.
Title: Re: Multi-Site host and NT 12.41 issue
Post by: jking on May 16, 2022, 04:21:14 AM
Hi Bruce,

     I currently have my apps and host in separate folders.  For example:

          App A
          App B
          Host
          App C

      Is the recommendation to have the following?

          Host
               App A
               App B
               App C

      That is, the other dll apps should be sub-folders of the host app?

Thanks,

Jeff
Title: Re: Multi-Site host and NT 12.41 issue
Post by: jking on May 16, 2022, 12:35:37 PM
Hi Bruce,

Here is more info, answers to your questions:

     "In the Host setup, for each server, there's a "data path" setting.
What is this set to, for the ones that work ok, and the ones that don't?"

     I have attached an image showing the data path for each app.  The app I'm having trouble with is the next to the last one, BCDBFormApp.  They all look correct to me...none point to the host folder itself.

     "And I suppose, since you are using appPath, what is the appPath set to?
I'd be inclined to have your code use self.site.datapath not self.site.apppath"

     I tried replacing apppath with datapath, but this did not seem to change anything.  How can I determine the appPath (or datapath) at runtime?

Thanks,

Jeff

     

Title: Solved !! Re: Multi-Site host and NT 12.41 issue
Post by: jking on May 16, 2022, 05:51:16 PM
Hi Bruce,

     I looked at the WebHandler ProcessLink procedure in the Host app and noticed the code there was before the Parent Call.  In my two problem apps, the code was after the Parent Call.  In the apps that did work as expected, they were also before the Parent Call.  So, I moved the problem app code to before the Parent Call and they now work as expected.  They no longer create files in the host folder.
     Next, I'll look at using self.site.datapath instead of self.site.apppath.

Thanks,

Jeff
Title: Re: Multi-Site host and NT 12.41 issue
Post by: Bruce on May 17, 2022, 07:40:18 PM
>> Is the recommendation to have the following?
          Host
               App A
               App B
               App C

Not really. My recommendation is to have
  Host.Exe
  App A.DLL
  App B.DLL
  App C.DLL
all in the same folder.

That's because all DLL's used by AppA.DLL etc need to be in the host folder, NOT the AppA folder.

So while AppA.DLL can be in a sub folder, if APPA.DLL uses say APPD.DLL then AppD.DLL _has_ to be in the host folder. (because Windows finds DLL's in the Exe folder NOT DLL folder when auto-loading them). AppA.DLL is loaded manually, but AppD is loaded automatically, so windows looks in the Exe folder _not_ the DLL folder.

This is complicated to explain, so if you didn't get it, follow a simple rule and put everything in the host.exe folder.

Title: Re: Multi-Site host and NT 12.41 issue
Post by: DonRidley on May 18, 2022, 03:46:19 AM
This is good advice! It will make your life so much easier when working with the MultiSite host.

Not really. My recommendation is to have
  Host.Exe
  App A.DLL
  App B.DLL
  App C.DLL
all in the same folder.

I run multiple MultiSite host EXE's behind an Nginx load balancer.  Talk about keeping Path settings correct.  LOL!

Good luck with your problem.  Let me know if you still have problems.  Been using the MultiSite host exclusively for years.
Title: Re: Multi-Site host and NT 12.41 issue
Post by: jking on May 19, 2022, 09:35:09 AM
Thanks Don and Bruce.

With the App A, B and C dlls in the host.exe folder, do I leave all the App data files (tps), web folder, etc., in thier respective folders?

Thanks,

Jeff
Title: Re: Multi-Site host and NT 12.41 issue
Post by: Bruce on May 20, 2022, 07:44:37 AM
I do, yes.
Obviously your program code has to "find" them, set their pathnames etc.
I use p_web.site.datapath for this (setting that in the host appropriately.)

cheers
Bruce