【发布时间】:2011-07-03 23:11:04
【问题描述】:
我正在尝试向我的客户端配置文件添加一个行为元素,以便我可以指定 maxItemsInObjectGraph。
我得到的错误是:元素“system.serviceModel”的子元素“行为”无效。预期的可能元素列表:“绑定、客户端、扩展”。
这是我的配置:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_KernService"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="ServiceViewEventBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="http://localhost/KernMobile.WCF/KernService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_KernService"
contract="KernWcfService.KernService" name="BasicHttpBinding_KernService"
behaviorConfiguration="ServiceViewEventBehavior" />
</client>
</system.serviceModel>
</configuration>
它还抱怨端点元素中的 behaviorConfiguration 属性。
有什么想法吗? .Net 4.0 顺便说一句。
编辑:我还应该指出,这是在 WP7 项目中。
【问题讨论】:
-
我想您所指的错误出现在 Visual Studio 错误列表中。对吗?
-
我在编辑器中看到一条弯曲的蓝线,当我将鼠标悬停在工具提示中时,错误出现在工具提示中。如果我运行该应用程序,我会在服务客户端构造函数中抛出一个无效操作异常:无法识别的元素“行为”。
标签: .net wcf windows-phone-7 config