I have a WCF Service where I have implemented a service method with an out argument of a type which is an Interface like this
bool GetFoo(out IFoo foo)
{
foo = new AFoo();
return true;
}
Here IFoo is the interface & AFoo is the concrete type that inherits.
Then on the Client Side I am calling this method using the service reference & receving the following error
System.ServiceModel.CommunicationException: 'An error occurred while receiving the HTTP response to http://localhost:4504/MyService. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.'
What is Interesting is that when I remove the interface argument from the service method, everything works just fine. For example
bool GetFoo()
{
IFoo foo = new AFoo();
return true;
}
The AFoo type is already a known type on the Client side and I can use it normally.
Update 1
Adding a Base Class Foo such that Afoo inherits from Foo & Foo inherits from IFoo ex: AFoo : Foo : IFoo (logically) has the same error when the service method is modified as
bool GetFoo(out Foo foo)
{
foo = new AFoo();
return true;
}
Again I kept all Classes & Interfaces empty (meaning they have nothing inside them)
Update 2
The following seems to work perfectly fine
bool GetFoo(out AFoo foo)
{
foo = new AFoo();
return true;
}
Why did not the Base Class Foo worked? Any Ideas?