2016-07-12 38 views
0

我目前正在爲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」 。這可能是因爲沒有爲您的應用程序找到配置 文件,或者因爲在客戶端元素中找不到與此合同相匹配的端點元素 。

我懷疑錯誤的原因是第三方應用程序沒有配置文件。 你有什麼想法如何解決這個問題?

回答

相關問題