11using Azure . Core ;
2+ using Grpc . Net . Client ;
23using Microsoft . DurableTask . Client ;
34using Microsoft . DurableTask . Worker ;
45using System . Diagnostics ;
@@ -79,12 +80,8 @@ static GrpcChannel GetGrpcChannelForOptions(DurableTaskSchedulerOptions options)
7980 }
8081
8182 string resourceId = options . ResourceId ?? "https://durabletask.io" ;
82- #if NET6_0
8383 int processId = Environment . ProcessId ;
84- #else
85- int processId = Process . GetCurrentProcess ( ) . Id ;
86- #endif
87- string workerId = options . WorkerId ?? $ "{ Environment . MachineName } ,{ processId } ,{ Guid . NewGuid ( ) } ";
84+ string workerId = options . WorkerId ?? $ "{ Environment . MachineName } ,{ processId } ,{ Guid . NewGuid ( ) : N} ";
8885
8986 TokenCache ? cache =
9087 options . Credential is not null
@@ -114,8 +111,7 @@ options.Credential is not null
114111 ChannelCredentials channelCreds = endpoint . StartsWith ( "https://" ) ?
115112 ChannelCredentials . SecureSsl :
116113 ChannelCredentials . Insecure ;
117- #if NET6_0
118- return GrpcChannel . ForAddress ( this . options . Address , new GrpcChannelOptions
114+ return GrpcChannel . ForAddress ( options . EndpointAddress , new GrpcChannelOptions
119115 {
120116 // The same credential is being used for all operations.
121117 // https://learn.microsoft.com/aspnet/core/grpc/authn-and-authz#set-the-bearer-token-with-callcredentials
@@ -125,21 +121,6 @@ options.Credential is not null
125121 // only be done for local testing. We should hide this setting behind some kind of flag.
126122 UnsafeUseInsecureChannelCallCredentials = true ,
127123 } ) ;
128- #else
129- return new GrpcChannel (
130- endpoint ,
131- ChannelCredentials . Create ( channelCreds , managedBackendCreds ) ,
132- new GrpcChannelOptions
133- {
134- // The same credential is being used for all operations.
135- // https://learn.microsoft.com/aspnet/core/grpc/authn-and-authz#set-the-bearer-token-with-callcredentials
136- Credentials = ChannelCredentials . Create ( channelCreds , managedBackendCreds ) ,
137-
138- // TODO: This is not appropriate for use in production settings. Setting this to true should
139- // only be done for local testing. We should hide this setting behind some kind of flag.
140- UnsafeUseInsecureChannelCallCredentials = true ,
141- } ) ;
142- #endif
143124 }
144125
145126 static Exception RequiredOptionMissing ( string optionName )
0 commit comments