WCF Service class static constructor called in every call -


i have service class implementing contract follows:

interface icontractfoo {     void foo(); }  class servicefoo() : icontractfoo {     public static servicefoo()     {         log("static constructor called");     }      void foo()     {         log("foo called");     }  } 

what finiding each time foo api called, static constructor gets called. so, log looks -

static constructor called
foo called
static constructor called
foo called

this should not happening since static constructor. idea going wrong?

thanks help

by default, wcf services use "per-call" model. don't think marking constructor static change behavior. can change using servicebehavior attribute or changing servicebehavior settings in web.config file associated service.

here couple articles might decide model appropriate services:


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -