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

时间:2011-08-22 12:16:24

标签: wcf visual-studio-2010 service

错误:

  

找不到引用合同的默认端点元素   ServiceModel客户端配置中的“LDServiceHost.ILDService”   部分。这可能是因为找不到配置文件   您的应用程序,或者没有匹配此的端点元素   合同可以在客户要素中找到。

App.Config:

    <?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
  </configSections>
  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel" switchValue="Warning, ActivityTracing"
          propagateActivity="true">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelTraceListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
      <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelMessageLoggingListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="C:\_Demos\EF Code Samples\EFLayers\LDPresentation\app_tracelog.svclog"
          type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
          name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
      <add initializeData="C:\_Demos\EF Code Samples\EFLayers\LDPresentation\app_messages.svclog"
          type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
          name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
    </sharedListeners>
    <trace autoflush="true" />
  </system.diagnostics>



    <system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="WSHttpBinding_ILDService" 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>

      <diagnostics>
        <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
      </diagnostics>

        <client>
            <endpoint address="http://localhost:8732/Design_Time_Addresses/LibraryService/LDService/"
                binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ILDService"
                contract="LDServiceHost.ILDService" name="WSHttpBinding_ILDService">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>
</configuration>

如何解决?

1 个答案:

答案 0 :(得分:1)

您的配置位于库项目中。配置文件是.NET中不是特定于库的应用程序,因此配置需要位于.exe中而不是DLL中

将DLLs配置的system.serviceModel部分复制到应用程序的配置文件中,它应该可以找到它

顺便说一句:通常最好将问题全部放在一个地方,而不是添加到外部网站的链接 - 这些习惯与SO不同步,所以问题最终没有多大意义