无法在ServiceModel客户端配置部分中找到引用合同“IAuthenticationService”的默认端点元素

我尝试创建一个简单的WCF应用程序,我没有更改任何现有的默认配置。 我尝试使用使用svcutil.exe生成的TestClient来使用该服务。 它"Could not find default endpoint element that references contract 'IAuthenticationService' 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."显示错误消息"Could not find default endpoint element that references contract 'IAuthenticationService' 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." 我尝试将端点放到localhost:端口号/ test.svc,但它显示相同的错误。

我执行Web测试客户端后显示此代码。 在网上搜索了很长时间之后,我无法找出错误

这是我的testClients clientdll.config

                        

尝试删除那里的终点并使用

  compilation debug=true 

在web.config中。 然后尝试

 svcutil.exe http://your_wsdl 

你将生成一个output.config。 尝试使用output.config服务模型将servicemodel节点替换为客户端网站或应用程序。 它会工作

这可能是因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到与此合同匹配的端点元素。

绑定或合同的名称将是错误的。 你的困惑需要看起来像

           

确保bindingConfigurationbinding name匹配。 在上面的示例Binding1