Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6372355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:13:39+00:00 2026-05-25T01:13:39+00:00

I want to create a web-service that run a specific method on startup. this

  • 0

I want to create a web-service that run a specific method on startup.
this is the service’s interface:

namespace MyClass
{
    [ServiceContract]
    public interface IService
    {
        [OperationContract]
        string getData();

    }
}

and on the service itself i want a specific method (not one of those) to run when the service loads (or deployed to IIS). is there a way to do so?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T01:13:40+00:00Added an answer on May 25, 2026 at 1:13 am

    You need to be clear what really happens when a WCF service is hosting in IIS.

    • IIS provides a service host that loads on demand
    • when a request comes in, IIS instantiates the service host, which in turns instantiates an instance of your service class, passes it the parameters from the request, and then executes the appropriate method on the service class

    As such, there is no point in time when the “service loads” and then just lingers around in memory. The “service” isn’t just loaded when IIS starts up and then would be “present and ready” at all times…

    So where do you want to plug in??

    • when the service host loads in IIS? In that case, you’d have to create your own custom service host and register it with IIS so that IIS would use your custom host instead of the WCF default service host

    • when the actual service class is instantiated to handle the request? THen put your logic into the constructor of your service class – it will be executed each time a service class is instantiated to handle a request

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a web service in ASP.NET that fetches data from a
I have a JSON web service that I want to run on the same
I want to create a server that queries another web service every 5 mins
I want to create a web method that accepts a List of custom objects
I want to create an iPhone app which makes calls to a web service.
I want to create a web application that allows users to sign up, register
I am working on a code in C#.NET to create a web service that
I am trying to run integration tests against a REST web service process that
I want to make a web service that runs other people's code locally. Naturally,
I want to store an xml that I receive in my java web service.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.