locked
Application level variable with WCF service RRS feed

  • Question

  • User-1934530859 posted

    What is the best way to kick off an application level varible for a WCF service? I have a group of values that i pull from an XML file that I want to be avaialble globally while the WCF service is running.

    Tuesday, May 7, 2013 7:18 AM

Answers

  • User1221318268 posted

    store in a static verable

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 7, 2013 7:25 AM
  • User-166373564 posted

    Hi mrrogers

    I want to be avaialble globally while the WCF service is running.

    You can use static variables in WCF, synchronize the access to them, and it can be accessed from multiple threads concurrently. The values stored in static variables are accessible from everywhere in the AppDomain and remain in memory until the server is restarted. Please refer the discussion and example below,

    #Static Variables in WCF

    http://stackoverflow.com/questions/4984358/static-variables-in-wcf

    hope it helps you,

    With regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 14, 2013 1:51 AM

All replies

  • User1221318268 posted

    store in a static verable

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 7, 2013 7:25 AM
  • User-166373564 posted

    Hi mrrogers

    I want to be avaialble globally while the WCF service is running.

    You can use static variables in WCF, synchronize the access to them, and it can be accessed from multiple threads concurrently. The values stored in static variables are accessible from everywhere in the AppDomain and remain in memory until the server is restarted. Please refer the discussion and example below,

    #Static Variables in WCF

    http://stackoverflow.com/questions/4984358/static-variables-in-wcf

    hope it helps you,

    With regards

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 14, 2013 1:51 AM