# IComputeEnvironmentResource Methods

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [IComputeEnvironmentResource](/reference/api/csharp/aspire.hosting/icomputeenvironmentresource.md)
- Kind: `Methods`
- Members: `2`

Represents a compute environment resource.

## GetEndpointPropertyExpression(EndpointReferenceExpression)

> **Experimental:** ASPIRECOMPUTE002 - [Learn more](/diagnostics/aspirecompute002/)

- Name: `GetEndpointPropertyExpression(EndpointReferenceExpression)`
- Modifiers: `virtual`
- Returns: [ReferenceExpression](/reference/api/csharp/aspire.hosting/referenceexpression.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/IComputeEnvironmentResource.cs#L42-L65)

Gets a [ReferenceExpression](/reference/api/csharp/aspire.hosting/referenceexpression.md) representing a deployed endpoint property for the specified [EndpointReferenceExpression](/reference/api/csharp/aspire.hosting/endpointreferenceexpression.md).

```csharp
public interface IComputeEnvironmentResource
{
    public virtual ReferenceExpression GetEndpointPropertyExpression(
        EndpointReferenceExpression endpointReferenceExpression)
    {
        // ...
    }
}
```

## Parameters

- `endpointReferenceExpression` ([EndpointReferenceExpression](/reference/api/csharp/aspire.hosting/endpointreferenceexpression.md))
  The endpoint reference expression for which to retrieve a deployed endpoint property.

## Returns

[ReferenceExpression](/reference/api/csharp/aspire.hosting/referenceexpression.md) -- A [ReferenceExpression](/reference/api/csharp/aspire.hosting/referenceexpression.md) representing the deployed endpoint property.

## Exceptions

- `ArgumentNullException` -- Thrown when `endpointReferenceExpression` is `null`.
- `InvalidOperationException` -- Thrown when the requested endpoint property is unsupported, or when a non-HTTP/HTTPS endpoint does not specify a port.

## Remarks

Use this method when an endpoint property should be represented as a compute-environment-specific [ReferenceExpression](/reference/api/csharp/aspire.hosting/referenceexpression.md) instead of being resolved from a local endpoint allocation. The default implementation composes values from [IComputeEnvironmentResource.GetHostAddressExpression(EndpointReference)](/reference/api/csharp/aspire.hosting/icomputeenvironmentresource/methods.md#gethostaddressexpression-endpointreference), the endpoint scheme, and endpoint ports. HTTP and HTTPS endpoints use ports 80 and 443 respectively when no explicit port is configured.

## GetHostAddressExpression(EndpointReference)

> **Experimental:** ASPIRECOMPUTE002 - [Learn more](/diagnostics/aspirecompute002/)

- Name: `GetHostAddressExpression(EndpointReference)`
- Modifiers: `virtual`
- Returns: [ReferenceExpression](/reference/api/csharp/aspire.hosting/referenceexpression.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/IComputeEnvironmentResource.cs#L23)

Gets a [ReferenceExpression](/reference/api/csharp/aspire.hosting/referenceexpression.md) representing the host address or host name for the specified [EndpointReference](/reference/api/csharp/aspire.hosting/endpointreference.md).

```csharp
public interface IComputeEnvironmentResource
{
    public virtual ReferenceExpression GetHostAddressExpression(
        EndpointReference endpointReference)
    {
        // ...
    }
}
```

## Parameters

- `endpointReference` ([EndpointReference](/reference/api/csharp/aspire.hosting/endpointreference.md))
  The endpoint reference for which to retrieve the host address or host name.

## Returns

[ReferenceExpression](/reference/api/csharp/aspire.hosting/referenceexpression.md) -- A [ReferenceExpression](/reference/api/csharp/aspire.hosting/referenceexpression.md) representing the host address or host name (not a full URL).

## Remarks

The returned value typically contains only the host name or address, without scheme, port, or path information.
