Class GrpcChannel
Represents a gRPC channel. Channels are an abstraction of long-lived connections to remote servers. Client objects can reuse the same channel. Creating a channel is an expensive operation compared to invoking a remote call so in general you should reuse a single channel for as many calls as possible.
Inheritance
Implements
Namespace: Grpc.Net.Client
Assembly: Grpc.Net.Client.dll
Syntax
public sealed class GrpcChannel : ChannelBase, IDisposable
Methods
CreateCallInvoker()
Create a new
Declaration
public override CallInvoker CreateCallInvoker()
Returns
Type | Description |
---|---|
CallInvoker | A new |
Dispose()
Releases the resources used by the GrpcChannel class. Clients created with the channel can't be used after the channel is disposed.
Declaration
public void Dispose()
ForAddress(String)
Creates a GrpcChannel for the specified address.
Declaration
public static GrpcChannel ForAddress(string address)
Parameters
Type | Name | Description |
---|---|---|
System.String | address | The address the channel will use. |
Returns
Type | Description |
---|---|
GrpcChannel | A new instance of GrpcChannel. |
ForAddress(String, GrpcChannelOptions)
Creates a GrpcChannel for the specified address and configuration options.
Declaration
public static GrpcChannel ForAddress(string address, GrpcChannelOptions channelOptions)
Parameters
Type | Name | Description |
---|---|---|
System.String | address | The address the channel will use. |
GrpcChannelOptions | channelOptions | The channel configuration options. |
Returns
Type | Description |
---|---|
GrpcChannel | A new instance of GrpcChannel. |
ForAddress(Uri)
Creates a GrpcChannel for the specified address.
Declaration
public static GrpcChannel ForAddress(Uri address)
Parameters
Type | Name | Description |
---|---|---|
Uri | address | The address the channel will use. |
Returns
Type | Description |
---|---|
GrpcChannel | A new instance of GrpcChannel. |
ForAddress(Uri, GrpcChannelOptions)
Creates a GrpcChannel for the specified address and configuration options.
Declaration
public static GrpcChannel ForAddress(Uri address, GrpcChannelOptions channelOptions)
Parameters
Type | Name | Description |
---|---|---|
Uri | address | The address the channel will use. |
GrpcChannelOptions | channelOptions | The channel configuration options. |
Returns
Type | Description |
---|---|
GrpcChannel | A new instance of GrpcChannel. |