.net - WCF REST StarterKit and RequestInterceptor thread safety -


i looking technical information how requestinterceptor wcf rest starter kit works, didn't find wanted. let's @ code snippet took custom service host factory:

    protected override system.servicemodel.servicehost createservicehost(type servicetype, uri[] baseaddresses)     {         var host = (webservicehost2)base.createservicehost(servicetype, baseaddresses);         var authenticationprovider = container.trygetinstance<iauthenticationprovider>();         var authorizationrepository = container.trygetinstance<iuserfinder>();         if (authenticationprovider == null)             authenticationprovider = new defaultauthenticationprovider(authorizationrepository);         var securitycontext = new securitycontext();         host.interceptors.add(new authenticationinterceptor(authenticationprovider, securitycontext));         return host;     } 

that code increateservicehost method executed once.

however on every http request authenticationinterceptor executed. can see authenticationinterceptor has dependencies on securitycontext class , iuserfinder repository.

what happens when several http request come @ same time?

  1. does wcf execute authenticationinterceptor concurrently means securitycontext , iuserfinder instance should thread safe? iuserfinder depends on data base resources.
  2. each request executed 1 after authenticationinterceptor can't executed concurrently 2 different calls?

i found on own. seems given request requestinterceptors run in thread safe manner before next request handled. requests queued until first request finish go through request interceptors.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -