# EndpointAnnotation Constructors

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [EndpointAnnotation](/reference/api/csharp/aspire.hosting/endpointannotation.md)
- Kind: `Constructors`
- Members: `2`

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

## EndpointAnnotation(ProtocolType, string?, string?, string?, int?, int?, bool?, bool)

- Name: `Constructor(ProtocolType, string?, string?, string?, int?, int?, bool?, bool)`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/EndpointAnnotation.cs#L48-L59)

Initializes a new instance of [EndpointAnnotation](/reference/api/csharp/aspire.hosting/endpointannotation.md).

```csharp
public sealed class EndpointAnnotation
{
    public EndpointAnnotation(
        ProtocolType protocol,
        string? uriScheme = null,
        string? transport = null,
        string? name = null,
        int? port = null,
        int? targetPort = null,
        bool? isExternal = null,
        bool isProxied = true)
    {
        // ...
    }
}
```

## Parameters

- `protocol` (`ProtocolType`)
  Network protocol: TCP or UDP are supported today, others possibly in future.
- `uriScheme` (`string?`) `optional`
  If a service is URI-addressable, this is the URI scheme to use for constructing service URI.
- `transport` (`string?`) `optional`
  Transport that is being used (e.g. http, http2, http3 etc).
- `name` (`string?`) `optional`
  Name of the service.
- `port` (`int?`) `optional`
  Desired port for the service.
- `targetPort` (`int?`) `optional`
  This is the port the resource is listening on. If the endpoint is used for the container, it is the container port.
- `isExternal` (`bool?`) `optional`
  Indicates that this endpoint should be exposed externally at publish time.
- `isProxied` (`bool`) `optional`
  Specifies if the endpoint will be proxied by DCP. Defaults to true.

## EndpointAnnotation(ProtocolType, NetworkIdentifier?, string?, string?, string?, int?, int?, bool?, bool)

- Name: `Constructor(ProtocolType, NetworkIdentifier?, string?, string?, string?, int?, int?, bool?, bool)`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/EndpointAnnotation.cs#L74-L280)

Initializes a new instance of [EndpointAnnotation](/reference/api/csharp/aspire.hosting/endpointannotation.md).

```csharp
public sealed class EndpointAnnotation
{
    public EndpointAnnotation(
        ProtocolType protocol,
        NetworkIdentifier? networkID,
        string? uriScheme = null,
        string? transport = null,
        string? name = null,
        int? port = null,
        int? targetPort = null,
        bool? isExternal = null,
        bool isProxied = true)
    {
        // ...
    }
}
```

## Parameters

- `protocol` (`ProtocolType`)
  Network protocol: TCP or UDP are supported today, others possibly in future.
- `networkID` ([NetworkIdentifier?](/reference/api/csharp/aspire.hosting/networkidentifier.md))
  The ID of the network that is the "default" network for the Endpoint. If a service is URI-addressable, this is the URI scheme to use for constructing service URI. Transport that is being used (e.g. http, http2, http3 etc). Name of the service. Desired port for the service. This is the port the resource is listening on. If the endpoint is used for the container, it is the container port. Indicates that this endpoint should be exposed externally at publish time. Specifies if the endpoint will be proxied by DCP. Defaults to true. Clients connected to the same network can reach the endpoint without any routing or network address translation.
- `uriScheme` (`string?`) `optional`
- `transport` (`string?`) `optional`
- `name` (`string?`) `optional`
- `port` (`int?`) `optional`
- `targetPort` (`int?`) `optional`
- `isExternal` (`bool?`) `optional`
- `isProxied` (`bool`) `optional`
