Our .Net 4 component accesses a third-party web service via a WCF client proxy. The WSDL for the third-party web service contains the Protect Tokens security policy:
<sp:ProtectTokens />
Accordingly, the custom binding configuration generated by Visual Studio 2013 contains:
protectTokens="true"
We've been using this for some weeks in our on-premises environment without any issues. However, on updating our Azure environment with this version of the app, we find it throws an exception:
Unrecognized attribute 'protectTokens'.
Note that attribute names are case-sensitive
MSDN seems conflicted on what .NET version supports protectTokens. The linked page is headed .NET 4.6 and 4.5, but its footer states "Available since 3.0". Regardless, the app is built for 4.0 and as I said, gives no error in the on-premises environment.
What is causing the error in Azure? This is OS Family 2 (2008R2).
SecurityElementBase.ProtectTokens Property if only available in framework >= 4.5
You can check ProtectTokens documentation here
Full SecurityElementBase class properties for framework 4.5 , 4.6 (you can get ProtectTokens property)
Full SecurityElementBase class properties for framework 4.0 (no such ProtectTokens property)
msdn documentation bug.
I was digging into IL in the assemblies SecurityElementBase.dll for .net 4 and 4.5. and guess what indeed there's no ProtectTokens
Property in .Net < 4.5 .
C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.ServiceModel.dll
C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.5\\System.ServiceModel.dll
You can verify it even more easily using VS2015 object explorer.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.