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

  • Home
  • SEARCH
  • 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 909545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:53:45+00:00 2026-05-15T16:53:45+00:00

I have code as following: Public Class xxxSvcHostFactory Inherits ServiceHostFactory Protected Overrides Function CreateServiceHost(ByVal

  • 0

I have code as following:

Public Class xxxSvcHostFactory
    Inherits ServiceHostFactory

    Protected Overrides Function CreateServiceHost(ByVal serviceType As Type, ByVal baseAddresses As Uri()) As ServiceHost
        Dim result As New WebServiceHost2(serviceType, True, baseAddresses)
        Return result
    End Function

End Class

Service contract is defined as below:

<ServiceContract()>
Public Interface IxxxSvc

    <Description("")>
    <OperationContract()>
    <WebGet(ResponseFormat:=WebMessageFormat.Json,
            UriTemplate:="CustomerDetails?id={CustomerId}")>
    Function GetCustomerDetails(ByVal CustomerId As String) As Customer


End Interface

Public Class MySvc
    Implements IxxxSvc

    Public Function GetCustomerDetails(ByVal CustomerId As String) As Customer Implements IxxxSvc.GetCustomerDetails
.
.
.
    End Function

End Class

When would CreateServiceHost gets executed?

Is it for every call, or for every transport session, or when the application startsup?

When does the ServiceHost expire?

If I implement static variable it is available through multiple sessions (say from IE and Firefox). How can I maintain static variable for a particular session (say if I access from IE, the same session should not be shared when I access from FF).

I am using WCF REST functionality in my application (core REST and not REST Starter kit).
thanks

  • 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-15T16:53:46+00:00Added an answer on May 15, 2026 at 4:53 pm

    It depends! 🙂 As always…..

    If you host this service in IIS by using a MyService.svc file, then IIS will instantiate the WebServiceHost for each incoming request and spin up a service class instance to handle the request (ok, it’s probably doing some caching on this – however, not quite clear how and how long the host will live etc.). IIS is said to have “message-based activation” – e.g. potentially each incoming message/request will activate the WebServiceHost.

    When you self-host in a Windows NT Service, console app etc., it’s obviously totally up to you – you create the WebServiceHost at your discretion, and then it’s up and running until you explicitly tear it down (or an unhandled exception brings it down). Self-hosting gives you a bit more control over lifetime of your WebServiceHost.

    Check out Hosting And Consuming WCF Services on MSDN – has lots of interesting info on hosting and lifetime of your service host and so forth.

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

Sidebar

Related Questions

If I have the following code: [TestFixture] public class MyBaseTest { protected ISessionManager _sessionManager;
I have the following code: public class Test { public static void Main() {
I have the following code: using System; using System.Linq; using System.Linq.Expressions; public class Program
I have the following code for factory design pattern implementation. class Pen{ public: virtual
I have following code public class TEST { public static void main(String arg[]){ try
I have following code: public class readSensorsData extends Activity implements SensorListener { /** Called
I have following code: public class LCS1 { public static String lcs(String a, String
I have following code: public abstract class TestProperty { public abstract Object PropertyValue {
I have the following code: public class OMyObject { public int Id { get;
Suppose I have following code: public class CBase: AbstractC,IRenderable { //code here } public

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.