# EndpointAnnotation Constructors

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

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/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/EndpointAnnotation.cs)

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 = null)
    {
        // ...
    }
}
```

## 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 `null`.

## 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/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/EndpointAnnotation.cs)

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

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

## Parameters

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

## 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/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/EndpointAnnotation.cs)

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 = null)
    {
        // ...
    }
}
```

## 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. Clients connected to the same network can reach the endpoint without any routing or network address translation.
- `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 `null`.

## 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/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/ApplicationModel/EndpointAnnotation.cs)

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,
        string? transport,
        string? name,
        int? port,
        int? targetPort,
        bool? isExternal,
        bool isProxied)
    {
        // ...
    }
}
```

## 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. Clients connected to the same network can reach the endpoint without any routing or network address translation.
- `uriScheme` (`string?`)
  If a service is URI-addressable, this is the URI scheme to use for constructing service URI.
- `transport` (`string?`)
  Transport that is being used (e.g. http, http2, http3 etc).
- `name` (`string?`)
  Name of the service.
- `port` (`int?`)
  Desired port for the service.
- `targetPort` (`int?`)
  This is the port the resource is listening on. If the endpoint is used for the container, it is the container port.
- `isExternal` (`bool?`)
  Indicates that this endpoint should be exposed externally at publish time.
- `isProxied` (`bool`)
  Specifies if the endpoint will be proxied by DCP.
