---
title: WcfEnvironmentService
summary: API reference for WcfEnvironmentService.
status: draft
owner: <owner>
last_reviewed: 2026-07-23
library: SAIF.Framework.Security.EnvironmentApi
reference_type: package
---

# WcfEnvironmentService

`WcfEnvironmentService` is the host-specific `EnvironmentServiceBase` implementation for WCF service-host contexts. It resolves the application id and host from an incoming `RequestContext`'s message headers.

## Purpose
- Supply WCF-service-host-specific environment resolution, deriving the application id and host from the inbound request's `To` header URI.

## Context
- Namespace: `SAIF.Framework.Security`
- Assembly/package: `SAIF.Framework.Security.EnvironmentApi`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| WcfEnvironmentService(context, sections) | `public WcfEnvironmentService(RequestContext context, params string[] sections)` | Constructs the service and initializes the request URI/`ApplicationId` from the `RequestContext`, loading the specified configuration sections. |
| WcfEnvironmentService(context) | `public WcfEnvironmentService(RequestContext context)` | Constructs the service and initializes the request URI/`ApplicationId` from the `RequestContext`. |
| ApplicationHost | `override string ApplicationHost { get; }` | Returns a dev-host fallback (`entdev03` via `GetHostFromAppConfig()`) when `IsDeveloperMachine` is true, the local machine name when `IsLocalMachine` is true, otherwise `EnvironmentHost.ResolveHost()` against the request URI. |
| MachineName | `override string MachineName { get; }` | Returns `Environment.MachineName`. |
| IsClientExternal | `override bool IsClientExternal { get; }` | Always `false`. |
| IsClientInsideFirewall | `override bool IsClientInsideFirewall { get; }` | Always `true`. |
| IsLocalMachine | `override bool IsLocalMachine { get; }` | `true` when the request URI `IsLoopback`. |
| IsWeb | `override bool IsWeb { get; }` | Always `true`. |
| User | `override IPrincipal User { get; }` | Returns `Thread.CurrentPrincipal`. |

## Inherited public members

Members in this section are inherited from `EnvironmentServiceBase` in `SAIF.Framework.Security.EnvironmentApi`. They are available on this type through inheritance.

| Member | Signature | Purpose | Origin |
| --- | --- | --- | --- |
| GetConfigSetting | `string GetConfigSetting(string configKey)` | Retrieves a plain-text configuration value | `SAIF.Framework.Security.EnvironmentApi` — `EnvironmentServiceBase` |
| GetConfigSetting\<T\> | `T GetConfigSetting<T>(string configKey)` | Retrieves a typed configuration value | `SAIF.Framework.Security.EnvironmentApi` — `EnvironmentServiceBase` |
| GetApplicationEnvironment | `ApplicationEnvironment GetApplicationEnvironment()` | Returns the current deployment tier | `SAIF.Framework.Security.EnvironmentApi` — `EnvironmentServiceBase` |
| GetApplicationTrack | `string GetApplicationTrack()` | Returns the current application's deployment track | `SAIF.Framework.Security.EnvironmentApi` — `EnvironmentServiceBase` |
| IsDeveloperMachine | `virtual bool IsDeveloperMachine { get; }` | Determines developer-machine status | `SAIF.Framework.Security.EnvironmentApi` — `EnvironmentServiceBase` |
| Configurations | `ConfigurationSettings Configurations { get; }` | The current in-memory cached configuration settings | `SAIF.Framework.Security.EnvironmentApi` — `EnvironmentServiceBase` |

## Behavioral notes
- `Initialize(RequestContext)` (private) reads `context.RequestMessage.Headers.To` to derive both the request URI and, via `uri.ApplicationName()` (a `SAIF.Framework.Common` extension), the `ApplicationId`.
- `ApplicationHost` resolution order mirrors the same developer/local/remote fallback pattern used by `WebEnvironmentService`*.

## Constraints and usage notes
- Requires an active WCF `RequestContext`, typically supplied by a message inspector or dispatch operation at the service host layer.

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- SAIF.Framework.Security.EnvironmentApi\Services.Common\WcfEnvironmentService.cs
- SAIF.Framework.Security.EnvironmentApi\Services.Common\EnvironmentServiceBase.cs
