Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Constructor in a web service

Constructor in a web service

Scheduled Pinned Locked Moved ASP.NET
winformstestingbeta-testingquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goldoche
    wrote on last edited by
    #1

    I have an application in a Windows forms and I want to export it to a web service. In my application, there is some initialization done in the constructor of my windows form, as well as in the Load event handler. Obviously, this code executes only once, that is, at the beginning of the program. I've started to port this application to a Web Service, but I realised that the code in the constructor (where the InitializeComponent is) executes every time I call a function with the Invoke button of the testing interface. My initialization code is somewhat long and it simply cannot be that way... Is there a way to make my initialization code execute only once, just like it does in a Windows Form? Thank you very much!

    B 1 Reply Last reply
    0
    • G goldoche

      I have an application in a Windows forms and I want to export it to a web service. In my application, there is some initialization done in the constructor of my windows form, as well as in the Load event handler. Obviously, this code executes only once, that is, at the beginning of the program. I've started to port this application to a Web Service, but I realised that the code in the constructor (where the InitializeComponent is) executes every time I call a function with the Invoke button of the testing interface. My initialization code is somewhat long and it simply cannot be that way... Is there a way to make my initialization code execute only once, just like it does in a Windows Form? Thank you very much!

      B Offline
      B Offline
      badgrs
      wrote on last edited by
      #2

      haven't done much work with web services but I think they have a Global.asax file much like a web site. Add this to the project (there should be an option for it in the add object dialogue) and it'll generate several methods one of which is Application_Start.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups