# EndpointAnnotation

- Kind: `class`
- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Version: `13.3.0`
- Namespace: `Aspire.Hosting.ApplicationModel`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/EndpointAnnotation.cs)
- Implements: [IResourceAnnotation](/reference/api/csharp/aspire.hosting/iresourceannotation.md)

Represents an endpoint annotation that describes how a service should be bound to a network.

## Definition

```csharp
namespace Aspire.Hosting.ApplicationModel;

public sealed class EndpointAnnotation
    : Aspire.Hosting.ApplicationModel.IResourceAnnotation
{
    // ...
}
```

## Remarks

This class is used to specify the network protocol, port, URI scheme, transport, and other details for a service.

## Constructors

- [EndpointAnnotation(ProtocolType, string?, string?, string?, int?, int?, bool?, bool)](/reference/api/csharp/aspire.hosting/endpointannotation/constructors.md#constructor-protocoltype-string-string-string-int-int-bool-bool) -- Initializes a new instance of [EndpointAnnotation](/reference/api/csharp/aspire.hosting/endpointannotation.md).
- [EndpointAnnotation(ProtocolType, NetworkIdentifier?, string?, string?, string?, int?, int?, bool?, bool)](/reference/api/csharp/aspire.hosting/endpointannotation/constructors.md#constructor-protocoltype-networkidentifier-string-string-string-int-int-bool-bool) -- Initializes a new instance of [EndpointAnnotation](/reference/api/csharp/aspire.hosting/endpointannotation.md).

## Properties

- [AllAllocatedEndpoints](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#allallocatedendpoints) : [NetworkEndpointSnapshotList](/reference/api/csharp/aspire.hosting/networkendpointsnapshotlist.md) `get` -- Gets the list of all AllocatedEndpoints associated with this Endpoint.
- [AllocatedEndpoint](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#allocatedendpoint) : [AllocatedEndpoint?](/reference/api/csharp/aspire.hosting/allocatedendpoint.md) `get; set` -- Gets or sets the default [EndpointAnnotation.AllocatedEndpoint](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#allocatedendpoint) for this Endpoint.
- [AllocatedEndpointSnapshot](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#allocatedendpointsnapshot) : `ValueSnapshot<AllocatedEndpoint>` `get` `obsolete` -- Gets the [EndpointAnnotation.AllocatedEndpointSnapshot](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#allocatedendpointsnapshot) for the default [EndpointAnnotation.AllocatedEndpoint](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#allocatedendpoint).
- [DefaultNetworkID](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#defaultnetworkid) : [NetworkIdentifier](/reference/api/csharp/aspire.hosting/networkidentifier.md) `get` -- Gets the ID of the network that is the "default" network for the Endpoint (the one the Endpoint is associated with and can be reached without routing or network address translation).
- [ExcludeReferenceEndpoint](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#excludereferenceendpoint) : `bool` `get; set` -- Gets or sets a value indicating whether this endpoint is excluded from the default set when referencing the resource's endpoints via `WithReference(resource)`. When `true`, the endpoint is excluded from the default set and must be referenced explicitly using `WithReference(resource.GetEndpoint("name"))`.
- [IsExternal](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#isexternal) : `bool` `get; set` -- Indicates that this endpoint should be exposed externally at publish time.
- [IsProxied](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#isproxied) : `bool` `get; set` -- Indicates that this endpoint should be managed by DCP. This means it can be replicated and use a different port internally than the one publicly exposed. Setting to false means the endpoint will be handled and exposed by the resource.
- [Name](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#name) : `string` `get; set` -- Name of the service
- [Port](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#port) : `int?` `get; set` -- Desired port for the service
- [Protocol](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#protocol) : `ProtocolType` `get; set` -- Network protocol: TCP or UDP are supported today, others possibly in future.
- [TargetHost](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#targethost) : `string` `get; set` -- This is the address the resource is listening on. By default it is localhost.
- [TargetPort](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#targetport) : `int?` `get; set` -- This is the port the resource is listening on. If the endpoint is used for the container, it is the container port.
- [TlsEnabled](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#tlsenabled) : `bool` `get; set` -- Gets or sets a value indicating whether TLS is enabled for this endpoint.
- [Transport](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#transport) : `string` `get; set` -- Transport that is being used (e.g. http, http2, http3 etc).
- [UriScheme](/reference/api/csharp/aspire.hosting/endpointannotation/properties.md#urischeme) : `string` `get; set` -- If a service is URI-addressable, this property will contain the URI scheme to use for constructing service URI.
