簡體   English   中英

無法在ServiceModel客戶端配置部分中找到引用合同“IAuthenticationService”的默認端點元素

[英]Could not find default endpoint element that references contract 'IAuthenticationService' in the ServiceModel client configuration section

我嘗試創建一個簡單的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

<configuration>
    <system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="wsHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
                    transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                    allowCookies="false">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="Message">
                        <transport clientCredentialType="Windows" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="Windows" negotiateServiceCredential="true"
                            algorithmSuite="Default" establishSecurityContext="true" />
                    </security>
                </binding>
            </wsHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:2490/AuthenticationService.svc"
                binding="wsHttpBinding" bindingConfiguration="wsHttpBinding"
                contract="IAuthenicationService" name="wsHttpBinding">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

嘗試刪除那里的終點並使用

 compilation debug=true 

在web.config中。 然后嘗試

svcutil.exe http://your_wsdl

你將生成一個output.config。 嘗試使用output.config服務模型將servicemodel節點替換為客戶端網站或應用程序。 它會工作

這可能是因為沒有為您的應用程序找到配置文件,或者因為在客戶端元素中找不到與此合同匹配的端點元素。

綁定或合同的名稱將是錯誤的。 你的困惑需要看起來像

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="Binding1" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://foo" binding="basicHttpBinding" bindingConfiguration="Binding1" contract="Service.MyService" name="MyService" />
    </client>
  </system.serviceModel>

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM