# DevTunnelPortResource Constructors

- Package: [Aspire.Hosting.DevTunnels](/reference/api/csharp/aspire.hosting.devtunnels.md)
- Type: [DevTunnelPortResource](/reference/api/csharp/aspire.hosting.devtunnels/devtunnelportresource.md)
- Kind: `Constructors`
- Members: `1`

A resource representing a single forwarded endpoint/port on a dev tunnel. Contains an endpoint that resolves to the public tunnel URL of this port.

## DevTunnelPortResource(string, DevTunnelResource, EndpointReference, DevTunnelPortOptions?)

- Name: `Constructor(string, DevTunnelResource, EndpointReference, DevTunnelPortOptions?)`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.DevTunnels/DevTunnelResource.cs#L61-L73)

Initializes a new instance of the [DevTunnelPortResource](/reference/api/csharp/aspire.hosting.devtunnels/devtunnelportresource.md) class, representing a single forwarded endpoint/port on a dev tunnel.

```csharp
public sealed class DevTunnelPortResource
{
    public DevTunnelPortResource(
        string name,
        DevTunnelResource tunnel,
        EndpointReference targetEndpoint,
        DevTunnelPortOptions? options = null)
    {
        // ...
    }
}
```

## Parameters

- `name` (`string`)
  The name of the port resource.
- `tunnel` ([DevTunnelResource](/reference/api/csharp/aspire.hosting.devtunnels/devtunnelresource.md))
  The parent [DevTunnelResource](/reference/api/csharp/aspire.hosting.devtunnels/devtunnelresource.md) this port belongs to.
- `targetEndpoint` (`EndpointReference`)
  The endpoint to be forwarded through the tunnel.
- `options` ([DevTunnelPortOptions?](/reference/api/csharp/aspire.hosting.devtunnels/devtunnelportoptions.md)) `optional`
  Options controlling how this port is exposed.
