InstanceContext Constructor (ServiceHostBase^, Object^)
.NET Framework (current version)
Initializes a new instance of the InstanceContext class for a specified object that implements the service instance and is hosted by a specified host.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
Parameters
- host
-
Type:
System.ServiceModel::ServiceHostBase^
The ServiceHostBase that hosts the service.
- implementation
-
Type:
System::Object^
The object that implements the service instance.
The following code illustrates how to create an InstanceContext object by first creating the service object and ServiceHost object:
Uri baseAddress = new Uri("http://localhost:8000/ServiceModelSamples/service"); CalculatorService service = new CalculatorService(); ServiceHost serviceHost = new ServiceHost(service, baseAddress); InstanceContext instanceContext = new InstanceContext(serviceHost,service); string info = ""; info += " " + "State: " + instanceContext.State.ToString() + "\n"; info += " " + "ManualFlowControlLimit: " + instanceContext.ManualFlowControlLimit.ToString() + "\n"; info += " " + "HashCode: " + instanceContext.GetHashCode().ToString() + "\n"; Console.WriteLine(info);
.NET Framework
Available since 3.0
Available since 3.0
Show: