@@ -14,7 +14,6 @@ namespace System.ServiceModel
14
14
{
15
15
public abstract class ChannelFactory : CommunicationObject , IChannelFactory , IDisposable , IAsyncDisposable
16
16
{
17
- private string _configurationName ;
18
17
private ClientCredentials _readOnlyClientCredentials ;
19
18
private object _openLock = new object ( ) ;
20
19
@@ -111,19 +110,6 @@ protected internal void EnsureOpened()
111
110
}
112
111
}
113
112
114
- // configurationName can be:
115
- // 1. null: don't bind any per-endpoint config (load common behaviors only)
116
- // 2. "*" (wildcard): match any endpoint config provided there's exactly 1
117
- // 3. anything else (including ""): match the endpoint config with the same name
118
- protected virtual void ApplyConfiguration ( string configurationName )
119
- {
120
- // This method is in the public contract but is not supported on CORECLR or NETNATIVE
121
- if ( ! String . IsNullOrEmpty ( configurationName ) )
122
- {
123
- throw ExceptionHelper . PlatformNotSupported ( ) ;
124
- }
125
- }
126
-
127
113
protected abstract ServiceEndpoint CreateDescription ( ) ;
128
114
129
115
internal EndpointAddress CreateEndpointAddress ( ServiceEndpoint endpoint )
@@ -145,14 +131,7 @@ protected virtual IChannelFactory CreateFactory()
145
131
146
132
if ( Endpoint . Binding == null )
147
133
{
148
- if ( _configurationName != null )
149
- {
150
- throw DiagnosticUtility . ExceptionUtility . ThrowHelperError ( new InvalidOperationException ( SRP . Format ( SRP . SFxChannelFactoryNoBindingFoundInConfig1 , _configurationName ) ) ) ;
151
- }
152
- else
153
- {
154
- throw DiagnosticUtility . ExceptionUtility . ThrowHelperError ( new InvalidOperationException ( SRP . SFxChannelFactoryNoBindingFoundInConfigOrCode ) ) ;
155
- }
134
+ throw DiagnosticUtility . ExceptionUtility . ThrowHelperError ( new InvalidOperationException ( SRP . SFxChannelFactoryNoBindingFoundInConfigOrCode ) ) ;
156
135
}
157
136
158
137
return ServiceChannelFactory . BuildChannelFactory ( Endpoint , UseActiveAutoClose ) ;
@@ -236,42 +215,20 @@ internal bool HasDuplexOperations()
236
215
return false ;
237
216
}
238
217
239
- protected void InitializeEndpoint ( string configurationName , EndpointAddress address )
218
+ protected void InitializeEndpoint ( EndpointAddress address )
240
219
{
241
220
Endpoint = CreateDescription ( ) ;
242
-
243
- ServiceEndpoint serviceEndpointFromConfig = null ;
244
-
245
- // Project N and K do not support System.Configuration, but this method is part of Windows Store contract.
246
- // The configurationName==null path occurs in normal use.
247
- if ( configurationName != null )
248
- {
249
- throw ExceptionHelper . PlatformNotSupported ( ) ;
250
- // serviceEndpointFromConfig = ConfigLoader.LookupEndpoint(configurationName, address, this.serviceEndpoint.Contract);
251
- }
252
-
253
- if ( serviceEndpointFromConfig != null )
221
+ if ( address != null )
254
222
{
255
- Endpoint = serviceEndpointFromConfig ;
223
+ Endpoint . Address = address ;
256
224
}
257
- else
258
- {
259
- if ( address != null )
260
- {
261
- Endpoint . Address = address ;
262
- }
263
225
264
- ApplyConfiguration ( configurationName ) ;
265
- }
266
- _configurationName = configurationName ;
267
226
EnsureSecurityCredentialsManager ( Endpoint ) ;
268
227
}
269
228
270
229
protected void InitializeEndpoint ( ServiceEndpoint endpoint )
271
230
{
272
231
Endpoint = endpoint ?? throw DiagnosticUtility . ExceptionUtility . ThrowHelperArgumentNull ( nameof ( endpoint ) ) ;
273
-
274
- ApplyConfiguration ( null ) ;
275
232
EnsureSecurityCredentialsManager ( Endpoint ) ;
276
233
}
277
234
@@ -288,7 +245,6 @@ protected void InitializeEndpoint(Binding binding, EndpointAddress address)
288
245
Endpoint . Address = address ;
289
246
}
290
247
291
- ApplyConfiguration ( null ) ;
292
248
EnsureSecurityCredentialsManager ( Endpoint ) ;
293
249
}
294
250
@@ -416,32 +372,7 @@ public ChannelFactory()
416
372
{
417
373
ServiceModelActivity . Start ( activity , SRP . Format ( SRP . ActivityConstructChannelFactory , typeof ( TChannel ) . FullName ) , ActivityType . Construct ) ;
418
374
}
419
- InitializeEndpoint ( ( string ) null , null ) ;
420
- }
421
- }
422
-
423
- // TChannel provides ContractDescription, attr/config [TChannel,name] provides Address,Binding
424
- public ChannelFactory ( string endpointConfigurationName )
425
- : this ( endpointConfigurationName , null )
426
- {
427
- }
428
-
429
- // TChannel provides ContractDescription, attr/config [TChannel,name] provides Binding, provide Address explicitly
430
- public ChannelFactory ( string endpointConfigurationName , EndpointAddress remoteAddress )
431
- : this ( typeof ( TChannel ) )
432
- {
433
- using ( ServiceModelActivity activity = DiagnosticUtility . ShouldUseActivity ? ServiceModelActivity . CreateBoundedActivity ( ) : null )
434
- {
435
- if ( DiagnosticUtility . ShouldUseActivity )
436
- {
437
- ServiceModelActivity . Start ( activity , SRP . Format ( SRP . ActivityConstructChannelFactory , typeof ( TChannel ) . FullName ) , ActivityType . Construct ) ;
438
- }
439
- if ( endpointConfigurationName == null )
440
- {
441
- throw DiagnosticUtility . ExceptionUtility . ThrowHelperArgumentNull ( nameof ( endpointConfigurationName ) ) ;
442
- }
443
-
444
- InitializeEndpoint ( endpointConfigurationName , remoteAddress ) ;
375
+ InitializeEndpoint ( ( EndpointAddress ) null ) ;
445
376
}
446
377
}
447
378
@@ -615,21 +546,6 @@ private void ReflectOnCallbackInstance(ServiceEndpoint endpoint)
615
546
}
616
547
}
617
548
618
- //Static funtions to create channels
619
- protected static TChannel CreateChannel ( String endpointConfigurationName )
620
- {
621
- ChannelFactory < TChannel > channelFactory = new ChannelFactory < TChannel > ( endpointConfigurationName ) ;
622
-
623
- if ( channelFactory . HasDuplexOperations ( ) )
624
- {
625
- throw DiagnosticUtility . ExceptionUtility . ThrowHelperError ( new InvalidOperationException ( SRP . Format ( SRP . SFxInvalidStaticOverloadCalledForDuplexChannelFactory1 , channelFactory . _channelType . Name ) ) ) ;
626
- }
627
-
628
- TChannel channel = channelFactory . CreateChannel ( ) ;
629
- SetFactoryToAutoClose ( channel ) ;
630
- return channel ;
631
- }
632
-
633
549
public static TChannel CreateChannel ( Binding binding , EndpointAddress endpointAddress )
634
550
{
635
551
ChannelFactory < TChannel > channelFactory = new ChannelFactory < TChannel > ( binding , endpointAddress ) ;
0 commit comments