# NatsServerResource Properties

- Package: [Aspire.Hosting.Nats](/reference/api/csharp/aspire.hosting.nats.md)
- Type: [NatsServerResource](/reference/api/csharp/aspire.hosting.nats/natsserverresource.md)
- Kind: `Properties`
- Members: `8`

A resource that represents a NATS server container.

## ConnectionStringExpression

- Name: `ConnectionStringExpression`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Nats/NatsServerResource.cs#L70)

Gets the connection string expression for the NATS server.

```csharp
public ReferenceExpression ConnectionStringExpression { get; }
```

## Host

- Name: `Host`
- Modifiers: `get`
- Returns: `EndpointReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Nats/NatsServerResource.cs#L39)

Gets the host endpoint reference for this resource.

```csharp
public EndpointReferenceExpression Host { get; }
```

## PasswordParameter

- Name: `PasswordParameter`
- Modifiers: `nullable` `get; set`
- Returns: `ParameterResource?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Nats/NatsServerResource.cs)

Gets or sets the password for the NATS server.

```csharp
public ParameterResource? PasswordParameter { get; set; }
```

## Port

- Name: `Port`
- Modifiers: `get`
- Returns: `EndpointReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Nats/NatsServerResource.cs#L44)

Gets the port endpoint reference for this resource.

```csharp
public EndpointReferenceExpression Port { get; }
```

## PrimaryEndpoint

- Name: `PrimaryEndpoint`
- Modifiers: `get`
- Returns: `EndpointReference`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Nats/NatsServerResource.cs#L34)

Gets the primary endpoint for the NATS server.

```csharp
public EndpointReference PrimaryEndpoint { get; }
```

## UriExpression

- Name: `UriExpression`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Nats/NatsServerResource.cs#L78)

Gets the connection URI expression for the NATS server.

```csharp
public ReferenceExpression UriExpression { get; }
```

## Remarks

Format: `nats://[user:password@]{host}:{port}`. The credential segment is omitted when no credentials are configured.

## UserNameParameter

- Name: `UserNameParameter`
- Modifiers: `nullable` `get; set`
- Returns: `ParameterResource?`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Nats/NatsServerResource.cs)

Gets or sets the user name for the NATS server.

```csharp
public ParameterResource? UserNameParameter { get; set; }
```

## UserNameReference

- Name: `UserNameReference`
- Modifiers: `get`
- Returns: `ReferenceExpression`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Nats/NatsServerResource.cs#L58-L60)

Gets a reference to the user name for the NATS server.

```csharp
public ReferenceExpression UserNameReference { get; }
```

## Remarks

Returns the user name parameter if specified, otherwise returns the default user name "nats".
