# ComposeServicePort

- Kind: `class`
- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Version: `13.4.0`
- Namespace: `Aspire.Hosting.Publishing`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/Publishing/ComposeServiceInfo.cs)

Represents a port mapping for a compose service.

## Definition

```csharp
namespace Aspire.Hosting.Publishing;

public sealed class ComposeServicePort
{
    // ...
}
```

## Constructors

- [ComposeServicePort](/reference/api/csharp/aspire.hosting/composeserviceport/constructors.md#constructor)

## Properties

- [PublishedPort](/reference/api/csharp/aspire.hosting/composeserviceport/properties.md#publishedport) : `int?` `get; init` -- Gets the port published on the host.
- [TargetPort](/reference/api/csharp/aspire.hosting/composeserviceport/properties.md#targetport) : `int?` `get; init` -- Gets the target port inside the container.
