Lucas_Santos
Lucas_Santos

Reputation: 4740

Error when create a instance of WebService

I have a WebService that when I use the instance of this webservice, occurs the following error

// Instance of WebService
ServicoZap.EnvArqSenhaSoapClient envia = new ServicoZap.EnvArqSenhaSoapClient();

Error:

Could not find default endpoint element that references contract 'Contract Name' 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.

In my app.config the reference is OK.

But to test the webservice, I'm using another project in my solution, called Test.

In this project (Test), I don't have an app.config (I don't know if was necessary).

Can help me ?

Upvotes: 0

Views: 136

Answers (1)

Charleh
Charleh

Reputation: 14002

You need the app.config in the test project too in this case - copying it over to the test project is one way to fix this

Upvotes: 1

Related Questions