views:

890

answers:

1

I have created a console application that calls a method on a webservice. I have accessed the webservice and get the response back from the console application that I expect. When I create a separate test assembly and create some nunit tests which call the same method in the same way i get the following exception:-

System.InvalidOperationException: Could not find default endpoint element that references contract 'xxxxx.xxx' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

Anyone experienced this before?

+3  A: 

Yes, make sure you add an app.config file to the unit test project and add the same settings you have in the console application's config file to it.

Good luck!

Ricardo Villamil
Cheers for that fellahworked a treat!
anonym0use