Silverlight客户端是否支持WCF行为?
我正在尝试向Silverlight客户端添加WCF端点行为。但是,我在运行时遇到以下错误:Silverlight客户端是否支持WCF行为?,silverlight,wcf,wcf-binding,Silverlight,Wcf,Wcf Binding,我正在尝试向Silverlight客户端添加WCF端点行为。但是,我在运行时遇到以下错误: Unrecognized element 'behaviors' in service reference configuration. Note that only a subset of the Windows Communication Foundation configuration functionality is available in Silverlight. 确实不能在Silverli
Unrecognized element 'behaviors' in service reference configuration.
Note that only a subset of the Windows Communication Foundation
configuration functionality is available in Silverlight.
确实不能在Silverlight中扩展WCF端点吗?下面列出了我的ServiceReferences.ClientConfig文件,显示了我如何尝试添加名为MyBehaviorExtension的扩展:
<configuration>
<system.serviceModel>
<extensions>
<behaviorExtentions>
<add
name="MyBehaviorExtention"
type="MyTest,
MyBehaviorExtention,
Version=1.0.0.0,
Culture=neutral,
PublicKeyToken=null" />
</behaviorExtentions>
</extensions>
<behaviors>
<endpointBehaviors>
<behavior name="MyBehavior">
<MyBehaviorExtention />
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding
name="MyWebServicePortBinding"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint
name="MyWebServicePort"
address="http://localhost:8080/MyService"
binding="basicHttpBinding"
bindingConfiguration="MyWebServicePortBinding"
contract="MyServiceReference.MyWebService"
behaviorConfiguration="MyBehavior" />
</client>
</system.serviceModel>
</configuration>
这是否应该放在服务器端的web.config中?ServiceReferences.ClientConfig应包含与Web服务引用信息有关的信息,例如端点地址等。它包含服务的地址,并在编译生成的.xap文件中进行编译 以下是我使用行为扩展的web.config示例:
<extensions>
<behaviorExtensions>
<add name="silverlightFaults" type="MyApp.Web.Services.SilverlightFaultBehavior, MyApp.Web"/>
</behaviorExtensions>
</extensions>
<behaviors>
<endpointBehaviors>
<behavior name="SilverlightFaultBehavior">
<silverlightFaults />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
这就是我所需要的。My ServiceRefreferences.ClientConfig仅包含端点地址。它仅包含Windows通信基础(WCF)客户端配置的<强>子集< /强>。 我的服务器是Java,因此没有服务器端web.config。在客户端上,我只是尝试将消息检查器作为一种行为添加到端点。我能够通过编程(在客户端)完成这项工作,我想知道为什么我不能通过配置完成这项工作。我认为答案是该文件不支持行为。看见请注意,该文件具有.NETFramework 3配置文件的内容子集,该配置文件用于配置Windows通信基础(WCF)客户端代理。