InstanceContext.Host Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the host for the service instance.
public:
property System::ServiceModel::ServiceHostBase ^ Host { System::ServiceModel::ServiceHostBase ^ get(); };
public System.ServiceModel.ServiceHostBase Host { get; }
member this.Host : System.ServiceModel.ServiceHostBase
Public ReadOnly Property Host As ServiceHostBase
Property Value
The ServiceHostBase that hosts the service instance.
Exceptions
The service instance associated with this context is closed, but was not aborted.
The service instance associated with this context is in a faulted state.
Examples
The following code shows how to access the Host property:
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);
ServiceHost host = (ServiceHost) instanceContext.Host;
Applies to
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.