Reputation: 298
I have a class library targeting the .NET 6 framework that makes calls to a third-party web service. This class library is dynamically invoked from a .NET 6 web application. When making the first web service call, I receive a successful response. However, when attempting a second call to the web service, I encounter the following error:
System.InvalidCastException: Unable to cast object of type 'generatedProxy_2' to type 'ServiceReference.FileServiceType'
How can I resolve this error and successfully make multiple web service calls from my class library?
I think dynamic calling from web service jacks up some namespaces and throws this error because calling class library directly resolve this error but dynamic calling is required in my case.
Upvotes: 3
Views: 435