public CancellationToken CancellationToken { get; }
Cancellation token signals when call is cancelled. It is also triggered when the deadline is exceeeded or there was some other error (e.g. network problem).
Allows setting write options for the following write.
For streaming response calls, this property is also exposed as on IServerStreamWriter for convenience.
Both properties are backed by the same underlying value.
public Task WriteResponseHeadersAsync(Metadata responseHeaders)
Asynchronously sends response headers for the current call to the client. This method may only be invoked once for each call and needs to be invoked
before any response messages are written. Writing the first response message implicitly sends empty response headers ifWriteResponseHeadersAsynchaven't
been called yet.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003e\u003ccode\u003eServerCallContext\u003c/code\u003e is an abstract class providing the context for a server-side gRPC call.\u003c/p\u003e\n"],["\u003cp\u003eIt includes properties such as \u003ccode\u003eAuthContext\u003c/code\u003e, \u003ccode\u003eCancellationToken\u003c/code\u003e, and \u003ccode\u003eDeadline\u003c/code\u003e to manage authentication, cancellations, and timeouts.\u003c/p\u003e\n"],["\u003cp\u003eThe class offers methods to send response headers (\u003ccode\u003eWriteResponseHeadersAsync\u003c/code\u003e) and to create propagation tokens (\u003ccode\u003eCreatePropagationToken\u003c/code\u003e) for managing context across child calls.\u003c/p\u003e\n"],["\u003cp\u003eIt also contains properties to access details such as \u003ccode\u003eHost\u003c/code\u003e, \u003ccode\u003eMethod\u003c/code\u003e, \u003ccode\u003ePeer\u003c/code\u003e, \u003ccode\u003eRequestHeaders\u003c/code\u003e, \u003ccode\u003eResponseTrailers\u003c/code\u003e, and the \u003ccode\u003eStatus\u003c/code\u003e of the call.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eServerCallContext\u003c/code\u003e class also provides a \u003ccode\u003eUserState\u003c/code\u003e property and \u003ccode\u003eWriteOptions\u003c/code\u003e to handle custom states and writing options during the call.\u003c/p\u003e\n"]]],[],null,["# Class ServerCallContext (2.66.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.66.0 (latest)](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ServerCallContext)\n- [2.63.0](/dotnet/docs/reference/Grpc.Core/2.63.0/Grpc.Core.ServerCallContext)\n- [2.48.0](/dotnet/docs/reference/Grpc.Core/2.48.0/Grpc.Core.ServerCallContext) \n\n public abstract class ServerCallContext\n\nContext for a server-side call. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e ServerCallContext \n\nInherited Members\n-----------------\n\n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) \n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Grpc.Core](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core)\n\nAssembly\n--------\n\nGrpc.Core.Api.dll\n\nConstructors\n------------\n\n### ServerCallContext()\n\n protected ServerCallContext()\n\nCreates a new instance of `ServerCallContext`.\n\nProperties\n----------\n\n### AuthContext\n\n public AuthContext AuthContext { get; }\n\nGets the `AuthContext` associated with this call.\nNote: Access to AuthContext is an experimental API that can change without any prior notice.\n\n### AuthContextCore\n\n protected abstract AuthContext AuthContextCore { get; }\n\nProvides implementation of a non-virtual public member.\n\n### CancellationToken\n\n public CancellationToken CancellationToken { get; }\n\nCancellation token signals when call is cancelled. It is also triggered when the deadline is exceeeded or there was some other error (e.g. network problem).\n\n### CancellationTokenCore\n\n protected abstract CancellationToken CancellationTokenCore { get; }\n\nProvides implementation of a non-virtual public member.\n\n### Deadline\n\n public DateTime Deadline { get; }\n\nDeadline for this RPC. The call will be automatically cancelled once the deadline is exceeded.\n\n### DeadlineCore\n\n protected abstract DateTime DeadlineCore { get; }\n\nProvides implementation of a non-virtual public member.\n\n### Host\n\n public string Host { get; }\n\nName of host called in this RPC.\n\n### HostCore\n\n protected abstract string HostCore { get; }\n\nProvides implementation of a non-virtual public member.\n\n### Method\n\n public string Method { get; }\n\nName of method called in this RPC.\n\n### MethodCore\n\n protected abstract string MethodCore { get; }\n\nProvides implementation of a non-virtual public member.\n\n### Peer\n\n public string Peer { get; }\n\nAddress of the remote endpoint in URI format.\n\n### PeerCore\n\n protected abstract string PeerCore { get; }\n\nProvides implementation of a non-virtual public member.\n\n### RequestHeaders\n\n public Metadata RequestHeaders { get; }\n\nInitial metadata sent by client.\n\n### RequestHeadersCore\n\n protected abstract Metadata RequestHeadersCore { get; }\n\nProvides implementation of a non-virtual public member.\n\n### ResponseTrailers\n\n public Metadata ResponseTrailers { get; }\n\nTrailers to send back to client after RPC finishes.\n\n### ResponseTrailersCore\n\n protected abstract Metadata ResponseTrailersCore { get; }\n\nProvides implementation of a non-virtual public member.\n\n### Status\n\n public Status Status { get; set; }\n\nStatus to send back to client after RPC finishes.\n\n### StatusCore\n\n protected abstract Status StatusCore { get; set; }\n\nProvides implementation of a non-virtual public member.\n\n### UserState\n\n public IDictionary\u003cobject, object\u003e UserState { get; }\n\nGets a dictionary that can be used by the various interceptors and handlers of this\ncall to store arbitrary state.\n\n### UserStateCore\n\n protected virtual IDictionary\u003cobject, object\u003e UserStateCore { get; }\n\nProvides implementation of a non-virtual public member.\n\n### WriteOptions\n\n public WriteOptions? WriteOptions { get; set; }\n\nAllows setting write options for the following write.\nFor streaming response calls, this property is also exposed as on IServerStreamWriter for convenience.\nBoth properties are backed by the same underlying value.\n\n### WriteOptionsCore\n\n protected abstract WriteOptions? WriteOptionsCore { get; set; }\n\nProvides implementation of a non-virtual public member.\n\nMethods\n-------\n\n### CreatePropagationToken(ContextPropagationOptions?)\n\n public ContextPropagationToken CreatePropagationToken(ContextPropagationOptions? options = null)\n\nCreates a propagation token to be used to propagate call context to a child call.\n\n### CreatePropagationTokenCore(ContextPropagationOptions?)\n\n protected abstract ContextPropagationToken CreatePropagationTokenCore(ContextPropagationOptions? options)\n\nProvides implementation of a non-virtual public member.\n\n### WriteResponseHeadersAsync(Metadata)\n\n public Task WriteResponseHeadersAsync(Metadata responseHeaders)\n\nAsynchronously sends response headers for the current call to the client. This method may only be invoked once for each call and needs to be invoked\nbefore any response messages are written. Writing the first response message implicitly sends empty response headers if `WriteResponseHeadersAsync` haven't\nbeen called yet.\n\n### WriteResponseHeadersAsyncCore(Metadata)\n\n protected abstract Task WriteResponseHeadersAsyncCore(Metadata responseHeaders)\n\nProvides implementation of a non-virtual public member."]]