WCF error: Unrecognized element ‘extendedProtectionPolicy’.

來源:互聯網
上載者:User
文章目錄
  • 原因
  • 解決方案

問題

當在 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)"

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.