Shane van Wyk
Shane van Wyk

Reputation: 1900

Mono Consume WCF Service Fail ServiceClient Linux

I need help with this following exception. I am trying to consume a web WCF web service using basicHttpSecurity etc. I had a look at the Dev Pipe for Mono and what I am consuming is in the working section.

So the service im trying to consume is AccountService.svc. The proxy that is generated has a AccountServiceClient() object that I am using. On the line where you create the object it throws an exception and there is no way of debugging and stepping into that constructor.

The strange thing is that I can consume this service on my Windows Machine going though IIS. I can also consume with my Mac PC using the mod mono extension ect. But not on Ubuntu Linux machine. Can anyone shed some light on this? Can anyone explain why this is happening? How do I fix this?

Me creating a new instance of the client.

client = new AccountServiceClient ();

The AccountServiceClient() sniplet

public partial class AccountServiceClient : System.ServiceModel.ClientBase<EServicesAccountProxy.IAccountService>, EServicesAccountProxy.IAccountService

The exception that gets thrown.

System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 
at System.ServiceModel.Configuration.ConfigUtil.GetTypeFromConfigString (System.String name, NamedConfigCategory category) [0x00000] in <filename unknown>:0 
at System.ServiceModel.ChannelFactory.ApplyConfiguration (System.String endpointConfig) [0x00000] in <filename unknown>:0 
at System.ServiceModel.ChannelFactory.InitializeEndpoint (System.String endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] in <filename unknown>:0 
at System.ServiceModel.ChannelFactory`1[EServicesAccountProxy.IAccountService]..ctor (System.String endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] in <filename unknown>:0 
at System.ServiceModel.ClientBase`1[EServicesAccountProxy.IAccountService].Initialize (System.ServiceModel.InstanceContext instance, System.String endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) [0x00000] in <filename unknown>:0 
at System.ServiceModel.ClientBase`1[EServicesAccountProxy.IAccountService]..ctor (System.ServiceModel.InstanceContext instance, System.String endpointConfigurationName) [0x00000] in <filename unknown>:0 
at System.ServiceModel.ClientBase`1[EServicesAccountProxy.IAccountService]..ctor (System.ServiceModel.InstanceContext instance) [0x00000] in <filename unknown>:0 
at System.ServiceModel.ClientBase`1[EServicesAccountProxy.IAccountService]..ctor () [0x00000] in <filename unknown>:0 
at EServicesAccountProxy.AccountServiceClient..ctor () [0x00000] in <filename unknown>:0 
at TCShared.TCInsuranceSystem_EGW.GetAccount (TCShared.TCInsuranceSystemAccount objInsuranceSystemAccount) [0x00000] in <filename unknown>:0 

A Strange thing i have noticed also is that I get a LoaderException as well (System.TypeLoadException). I don't know if it is related because the message says that it could not load type 'Npgsql.VisualStudio.NpgsqlObjectSelector' from 'Npgsql.VisualStudio, vserion=2.0.2.1, culture-neutral, PublicKeyToken=null'. Im not even using VisualStudio, im using monodevelop and XamarinStudio on my windows machine.

She source in the exception message says if comes from "mscorelib"

Any help will be appreciated.

Upvotes: 0

Views: 423

Answers (1)

Shane van Wyk
Shane van Wyk

Reputation: 1900

Turns out there was an inner load exception and I had a Npgsql.VisualStudio DLL in my bin. Once i have removed that everything worked. Reflections failed to load that DLL because of missing references.

Upvotes: 1

Related Questions