WCF跟踪错误:找不到配置评估上下文

Mar*_*ark 7 .net wcf

我已经设置了一个自托管服务方案,我以编程方式设置了多个服务主机.对于我打开的每个主机,我在跟踪日志中看到以下错误:

<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Warning">
    <TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.EvaluationContextNotFound.aspx</TraceIdentifier>
    <Description>Configuration evaluation context not found.</Description>
    <AppDomain>myprogram.exe</AppDomain>
</TraceRecord>
Run Code Online (Sandbox Code Playgroud)

我已经读过这是因为使用了未在配置文件中声明的扩展,我确实使用了自定义行为扩展,但是将它添加到.exe的配置文件中没有任何效果:

<system.serviceModel>
    <extensions>
        <behaviorExtensions>
            <add name="myext" type="mytype, myassembly" />
        </behaviorExtensions>
    </extensions>
    ....
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

请注意,我没有在配置文件中的任何其他位置使用此扩展,我将以编程方式将其添加到服务主机.我甚至设置了一个虚拟行为,使用扩展只是为了看它是否能解决问题,但事实并非如此.

为什么我在日志中看到此错误?

小智 1

我遇到了这个问题,发现 ServiceReferences.clientconfig 文件中有多个 identicle 自定义绑定。我只是简单地注释掉了额外的内容,一切都很好。(我正在使用Silverlight调用WCF服务)

 <customBinding>
    <binding name="SecureTransportNoCredentialsEndpoint">
      <binaryMessageEncoding />
      <httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
    </binding>
    <!--<binding name="SecureTransportNoCredentialsEndpoint1">
      <binaryMessageEncoding />
      <httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
    </binding>
    <binding name="SecureTransportNoCredentialsEndpoint2">
      <binaryMessageEncoding />
      <httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
    </binding>
    <binding name="SecureTransportNoCredentialsEndpoint11">
      <binaryMessageEncoding />
      <httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
    </binding>
    <binding name="SecureTransportNoCredentialsEndpoint3">
      <binaryMessageEncoding />
      <httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
    </binding>
    <binding name="SecureTransportNoCredentialsEndpoint12">
      <binaryMessageEncoding />
      <httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
    </binding>-->
  </customBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)