WCF error: Unrecognized element 'extendedProtectionPolicy'.

问题

当在 Windows 7 上用 VS2008 开发 WCF 3.5 客户端程序时,VS 将在自动生成的配置文件的 xxxBinding/security/transport 节中插入

<extendedProtectionPolicy policyEnforcement="Never" />

如果将此程序部署到其他操作系统将报错:无法识别的元素“extendedProtectionPolicy” (Unrecognized element extendedProtectionPolicy)。

原因

这是一个已知的问题,仅存在 Windows 7 系统上,似乎 Windows 7 对 .NET 3.5 的特殊扩展,但其他早期版本操作系统又不支持,下面是来自 WCF Team 的解释:

Thank you for contacting us with your question.
Windows 7 has an additional security feature called Extended Protection. When you create an app.config for a client from the Windows 7 service, the tag "extendedProtectionPolicy" will be present in the app.config. When deploying the client to versions of Windows prior to Windows 7, this tag will not be valid. This is a known issue. This tag is not actually used by the client, so simply remove the tag. We will try to update future versions of .Net 3.5 to not include this tag in the generated app.config.
Thanks,
WCF Team

解决方法

直接移除这个节点即可。

这个问题在 .NET 4.0 已经被解决,不会再自动添加这个节点。

 

FW:WCF 错误: 无法识别的元素“extendedProtectionPolicy”

--------------------------------------------------------------------

new SearchBestBetClient(EndpointConfigurationName, adminServicesSettings.AdminServiceUrl)
'new SearchBestBetClient(EndpointConfigurationName, adminServicesSettings.AdminServiceUrl)' threw an exception of type 'System.Configuration.ConfigurationErrorsException'
    base {System.Configuration.ConfigurationException}: {"Unrecognized element 'extendedProtectionPolicy'. (C:\\Inetpub\\wwwroot\\wss\\VirtualDirectories\\8090\\web.config line 312)"}
    BareMessage: "Unrecognized element 'extendedProtectionPolicy'."
    Errors: {System.Configuration.ConfigurationException[0x00000001]}
    Filename: "C:\\Inetpub\\wwwroot\\wss\\VirtualDirectories\\8090\\web.config"
    Line: 0x00000138
    Message: "Unrecognized element 'extendedProtectionPolicy'. (C:\\Inetpub\\wwwroot\\wss\\VirtualDirectories\\8090\\web.config line 312)"

posted @ 2010-05-11 16:19  upzone  阅读(1060)  评论(0编辑  收藏  举报