2010-11-18 68 views
7

我已经设置了一个自我托管的服务场景,我以编程方式设置了多个服务主机。对于这些主机,我打开每一个,我看到在跟踪日志中出现以下错误: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> 

我读过,这是通过使用未在配置文件中声明的扩展造成的,我确实使用自定义行为扩展,但它添加到.exe文件的配置文件中没有任何作用:我不是在配置文件中使用这个扩展其他地方

<system.serviceModel> 
    <extensions> 
     <behaviorExtensions> 
      <add name="myext" type="mytype, myassembly" /> 
     </behaviorExtensions> 
    </extensions> 
    .... 
</system.serviceModel> 

注意,我将它添加以编程方式向服务主机发送。我甚至设置了一个虚拟行为,使用扩展名来查看它是否可以解决问题,但事实并非如此。

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

回答

1

我有这个问题,发现我在ServiceReferences.clientconfig文件中有多个标识自定义绑定。我只是评论了演员,一切都很好。 (我使用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> 
0

就我而言,我有WCF接口与包含字符串属性“GCM”,然后添加名为“GCM”一个新的类定义类。当我将类名更改为“GCMObj”时,错误消失了。

0

我的经验是,您必须在标签下手动创建具有服务名称和其他详细信息的服务。

例如

<system.serviceModel> 
     <services> 
      <service name="WCF_NameSpace.Service1" behaviorConfiguration="behave"> 
       <endpoint address="" binding="basicHttpBinding" bindingConfiguration="bind" contract="WCF_Trace_2.IService1"></endpoint> 
      </service> 
     </services> 
+0

不确定你的意思。你是说如果我使用这个扩展(通过绑定)创建一个服务(在配置中),错误会消失吗? – Mark 2014-11-09 00:10:35