简体   繁体   English

创建WebService实例时出错

[英]Error when create a instance of WebService

I have a WebService that when I use the instance of this webservice, occurs the following error 我有一个Web服务,当我使用此Web服务的实例时,发生以下错误

// 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. 在ServiceModel客户端配置部分中找不到引用合同“合同名称”的默认端点元素。 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. 在我的app.config中,引用确定。

But to test the webservice, I'm using another project in my solution, called Test. 但是要测试Web服务,我在解决方案中使用了另一个项目,称为Test。

In this project (Test), I don't have an app.config (I don't know if was necessary). 在此项目(测试)中,我没有app.config(我不知道是否有必要)。

Can help me ? 可以帮我 ?

在这种情况下,您也需要在测试项目中使用app.config-将其复制到测试项目中是解决此问题的一种方法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM