Hi All,
A .Net target DLL generated with PB 2017 R2 is called from a web service. It is fast and works as expected with a single web service request. With concurrent requests to the web service (two Users or more) the behavior is as follows:
1. both requests are hanging and never finished and time out or
2. when the second request hits the DLL the first request aborts and the second finishes properly
The web service is multi-thread and my understand is that the DLL should be instantiated for each request. However it seems to be shared.
Questions:
1. Is a PB .Net Target generated DLL thread safe, so it can be invoked in a multi-thread environment?
Any suggestions or ideas on how to overcome this situation are welcome.
Thank you,
Paulo Gomes
Interval Leisure Group
Thank you for the reply.
I read the PB Guide article you mentioned on Sysbooks and it seems to allow to make the DLL thread-safe by wrapping the function you want to call between statements like
System.Threading.Monitor.Enter(obj) and
System.Threading.Monitor.Exit(obj);
if you are using PB .Net, not the Classic.
Since I'm using PB2017 R2 built on Classic PB 12.6, the .Net classes and objects are not available in my environment.
Any other ideas?
Thank you for your time.
Paulo Gomes
Interval Leisure Group
Just add that .NET feature to your .Net Assembly project in PB 2017 IDE, as follows:
Add .NET Assembly (RHMB on your PB Target) then select .Net assemblies
Select the "mscorlib.dll" .Net Assembly
Open the .Net Assembly in the PB IDE's System Tree ...
Scroll down to the Threading section and select the class and property / method you want to use...
HTH
Thank you for the reply.
The PB .Net DLL is added as reference in a VS C# web service that I coded and deployed to IIS. The web service accepts requests from a web site and redirect the calls to the corresponding method in the PB DLL.
Everything works fine and very fast for 1 request. Apparently when a second request hits IIS, both processes hang and never end, no error returned.
I'll try to add the mscorlib.dll to the target and figure out which methods to use. The idea is to "tell" that the PB DLL is thread safe or not to be shared inside a IIS single work process.
Thank you for your help.
Cheers,
Paulo Gomes
Interval Leisure Group