我目前正在为C#中的第三方应用程序实现一个插件。该插件是一个库(DLL),它调用了一些Web服务。所以,我创建在Visual Studio中的服务引用,这是在app.config
文件的插件配置为这样:C# - 如何在第三方应用程序中设置服务参考配置
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="AuthenticationEndpointImplServiceSoapBinding" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8080/services/auth"
binding="basicHttpBinding" bindingConfiguration="AuthenticationEndpointImplServiceSoapBinding"
contract="AuthenticationWebService.AuthenticationEndpoint"
name="AuthenticationEndpointImplPort" />
</client>
</system.serviceModel>
</configuration>
我有另外一个项目,我使用的测试插件。当我从该项目调用服务时,它工作正常,只要我已将相同的配置复制到此项目的app.config
文件中。但是,当我构建插件和第三方应用程序中运行它,我得到以下信息:
找不到默认终结点元素,在ServiceModel 客户端配置部分引用合同 “AuthenticationWebService.AuthenticationEndpoint” 。这可能是因为没有为您的应用程序找到配置 文件,或者因为在客户端元素中找不到与此合同相匹配的端点元素 。
我怀疑错误的原因是第三方应用程序没有配置文件。 你有什么想法如何解决这个问题?