Null Return, when WCF Client [.Net8.0] communicate to WCF Server [.Net Framework 4.8]
- Dominant language
- C#
- Stars
- 1.8k
- Forks
- 576
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 2
Description
**Describe the bug**
When I call an async method on my service it works in most environments. But in one system (productive) I've got always null return instead of the expected data container. It makes no different which method I'll call. All of them return null. No exceptions when calling. Same code on both installations (dev and production).
**Additional context**
* Used client lib version:
```csproj
```
* NetTcp Binding (dual) is configured. App.config of server:
```xml
```
* ServiceClient init:
```csharp
using System.ServiceModel;
using System.ServiceModel.Channels;
public partial class MyServiceClient : DuplexClientBase, IServiceContract, IDisposable
{
public DualServiceClientImpl(string url, string endPointName, CallbackHandler callbackhandler)
#if NETFRAMEWORK
: base(callbackhandler, endPointName, new EndpointAddress(url))
#else
: base(new InstanceContext(callbackhandler), CreateBinding(endPointName), new EndpointAddress(url))
#endif
{ }
private static Binding CreateBinding(string endPointName, SecurityMode securityMode = SecurityMode.None)
=> new NetTcpBinding() {
CloseTimeout = TimeSpan.FromMinutes(10),
OpenTimeout = TimeSpan.FromMinutes(10),
SendTimeout= TimeSpan.FromMinutes(10),
MaxReceivedMessageSize = Int32.MaxValue,
ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas()
{
MaxDepth = 64,
MaxStringContentLength = MAX_QUOTA_LENGTH,
MaxArrayLength= MAX_QUOTA_LENGTH,
MaxBytesPerRead= MAX_QUOTA_LENGTH,
MaxNameTableCharCount = 16384
},
Security = CreateBindingSecurity(securityMode)
};
const int MAX_QUOTA_LENGTH = 10485760;
private static NetTcpSecurity CreateBindingSecurity(SecurityMode securityMode)
{
switch (securityMode)
{
// Works not in .Net Core
case SecurityMode.Message:
return new NetTcpSecurity {
Mode = SecurityMode.Message,
Message = new MessageSecurityOverTcp { ClientCredentialType = MessageCredentialType.Windows }
};
case SecurityMode.None:
return new NetTcpSecurity { Mode = SecurityMode.None };
default: throw new NotImplementedException();
}
}
}
```
Please help! I can't see the error.
Contributor guide
Assessment
This issue has not been assessed yet.