Inconsistent and Incorrect keepAliveEnabled Configuration for WCF Custom Bindings
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 370
Description
**Issue description**
The various pages that discuss disabling HTTP Keep-Alive for WCF custom bindings are inconsistent about where you should set the `keepAliveEnabled` attribute and it appears that at least one of them is incorrect.
On the WCF Load Balancing page (see https://docs.microsoft.com/en-us/dotnet/framework/wcf/load-balancing ), the example shows that you should set the `keepAliveEnabled` attribute on the `` element:
```
```
However, Visual Studio will complain about this XML with a `The "keepAliveEnabled" attribute is not allowed.` warning.
On the `` page (see https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/wcf/custombinding ), there is no indication that `keepAliveEnabled` is supported on the `` element. The page for the .Net classes that map to the `` element (see https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.configuration.custombindingelement?view=netframework-4.8 ) also suggest that there is no `keepAliveEnabled` property. From the Syntax section:
```
```
On the `` page (see https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/wcf/httptransport) and its corresponding .Net class (see https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.configuration.httptransportelement?view=netframework-4.8 ), the documentation seems to suggest that the correct place to set `keepAliveEnabled` is on the transport.
The `` page (see https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/wcf/httpstransport ) does not list a `keepAliveEnabled` attribute that corresponds to the HTTP version. However, the page for the associated .Net class (see https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.configuration.httpstransportelement?view=netframework-4.8 ) suggests that there is a `KeepAliveEnabled` property. The .Net class documentation also suggests that `HttpsTransportElement` inherits from `HttpTransportElement`, which in the .Net Framework configuration system would suggest that `` supports all of the attributes from ``.
In summary, I think the following updates need to be made:
* On the WCF Load Balancing page (https://docs.microsoft.com/en-us/dotnet/framework/wcf/load-balancing), the example should be updated to indicate that you set the `keepAliveEnabled` property on the `` element, not on the `` element.
* One of the `` page (see https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/wcf/httpstransport ) and the associated .Net class page (see https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.configuration.httpstransportelement?view=netframework-4.8 ) should be updated to be consistent about whether the keep alive setting can be configured for the HTTPS transport. My guess would be that the .Net class is correct, as `HttpsTransportElement` inherits from `HttpTransportElement` which suggests that they will support the same attributes.
**Target framework**
- [ ] .NET Core
- [ x ] .NET Framework
- [ ] .NET Standard
Microsoft Visual Studio Professional 2022
Version 17.2.3
VisualStudio.17.Release/17.2.3+32526.322
Microsoft .NET Framework
Version 4.8.04084
Contributor guide
Assessment
This issue has not been assessed yet.