Close if there are no active threads, or if they are active, then wait for completion and closing

Overview of my applications

alt text http://img823.imageshack.us/img823/8975/modelq.jpg

ASP.Net webservice entertains requests from various applications for digital signing and verification through the client. Then the web service will send these requests to the smart card.

When the system date changes, I want the following to happen.

  • New customer request made to wait

  • Ongoing work between the web service and the smart card must be completed.

  • If there are any preliminary pending requests, they should be completed.

The reason I need this to happen is to close existing sessions between the smart card and the web service. This should happen only when there is no signature / verification of files. I cannot just close all sessions, as this may affect the file processed by any of the threads. Therefore, I need to make sure that there are no current active flows between the web service and the smart card.

I wrote a code snippet that gives the total number of active threads between webservice and smart card.

int vWorkerThreads,vWorkerThreadsMax;
int vPortThreads,vPortThreadsMax;
System::Threading::ThreadPool ^ vThreadPool;
vThreadPool->GetAvailableThreads(vWorkerThreads, vPortThreads);
vThreadPool->GetMaxThreads(vWorkerThreadsMax, vPortThreadsMax);
ActiveThreadCount = vWorkerThreadsMax - vWorkerThreads;

Does this mean that I also need to make client requests wait?

CLEANUP MECHANISM: Close the PKCS # 11 API with a call C_CloseAllSessionsand C_Finalizethat will free the library to clear all session objects. This must be done every day.

Any ideas on how I can accomplish such a task?

UPDATE:

. , - - ASP.NET. - reset -. - - ASP.NET, -.

  • ,
  • WebService_Close_SmartCard
  • - WebService_Close_SmartCard , , PKCS11_Close_SmartCard. . PKCS11_Close_SmartCard will -.
  • , , PKCS11_DigitalSign_SmartCard/ PKCS11_DigitalVerify_SmartCard -, PKCS11_Close_SmartCard .

PS: ASP.NET .

+1
1

, ...

, \ -:

Quesiton. , ThreadPool /, - ?

, . API, -. webservice (/ ..) . -, /.

"", , .

ASP.NET , , , \queued .

, . ASP.NET , ( ), , . , , ASP.NET.

IIS "Recycle" . , "00:00".

, , , , - . " Application_End" .

2

. :

:

  • - - .
  • - , .

, . - ASP.NET, . , , .. . , .

3

, , . ASP.NET , "" -. ASP.NET, , , .

.

ASP.NET :

. . . , .

. Application_End , . , .

"".

, IIS , (). IIS - , web.config "touching", IIS:

. , , , web.config.

. , - "", "" web.config.

IIS, "a" .

, Microsoft .:)

4

@Raj OK, .

:

  • reset - .
  • - - , .
  • reset -.
  • , , , , - reset.

, , reset -, , reset.

:

  • - reset "Application_End".
  • IIS "00:00". , " " = "".
  • "00:00" .
  • "00:00" , , "3" , .
  • "3" "Applicaton_End". , - reset .
  • , , , "4", . , reset "5".

- , . "x, y, z", ASP.NET , "x, y, z" , .

, . , , ASP.NET . .

, , . , , "" , , . "Application_End" .

, .

+4

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


All Articles