Search code examples
c#.net-corechannelfactoryentrypointnotfoundexcept

EntryPointNotFoundException with ChannelFactory


I am trying to set up a ChannelFactory call from a .NET 6 client. I have added all the necessary dependencies. Interestingly, the exact same code runs perfectly fine in another project, but I'm having no luck getting it to work in this new project.

The binding is generated by the code itself (basicHttpBinding).

However, I encountered the following error:

System.EntryPointNotFoundException: Entry point was not found.
   at System.Collections.Generic.ICollection`1.get_Count()
   at System.ServiceModel.Channels.Binding.EnsureInvariants(String contractName)
   at System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose)
   at System.ServiceModel.ChannelFactory.OnOpening()
   at System.ServiceModel.Channels.CommunicationObject.System.ServiceModel.IAsyncCommunicationObject.OpenAsync(TimeSpan timeout)
   at System.ServiceModel.ChannelFactory.EnsureOpened()
   at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)`

Has anyone else experienced this problem?

Thanks in advance!


Solution

  • FOUND!

    By mistake, a NuGet package named System.ServiceModel.Primitives was updated to version 6.0.0 while all other System.ServiceModel.* packages were at version 4.10.

    I updated everything to version 6.0.0, and the error disappeared!

    I'll keep my post here just in case it could be helpful.