I have a solution in which a Silverlight application calls a WCF service (self-hosted in console application) which we'll call A, which calls another WCF service (hosted in IIS) which we'll call B.
WCF service A contains two standard methods and one methods which uses impersonation and calls WCF service B. I have no problems when I try calling WCF service A from Silverlight, including the call with the impersonation, but when I try to do the same from a ASP.NET application I get the following exception when I call WCF service B from the impersonation methods:
Could not load file or assembly 'System.IdentityModel.Selectors, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Exception from HRESULT: 0x80070542
Here is the relevant part of my web.config:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_IPrint">
<binaryMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
maxSessionSize="2048">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binaryMessageEncoding>
<httpTransport manualAddressing="false" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Ntlm"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
useDefaultWebProxy="true" />
</binding>
<binding name="WebHttpBinding_IClientAccessPolicy">
<textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
messageVersion="Soap12" writeEncoding="utf-8">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</textMessageEncoding>
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://localhost:8733/ClientAppsWCF" binding="customBinding"
bindingConfiguration="CustomBinding_IPrint" contract="ClientApps.IPrint"
name="CustomBinding_IPrint">
<identity>
<userPrincipalName value="ytal@ifnsystems.com" />
</identity>
</endpoint>
<endpoint binding="customBinding" bindingConfiguration="WebHttpBinding_IClientAccessPolicy"
contract="ClientApps.IClientAccessPolicy" name="WebHttpBinding_IClientAccessPolicy" />
</client>
</system.serviceModel>
Will appreciate if someone can help me out with this.
I'm not sure about the exact problem, but I'll try to help you from similar erros regarding impersonation.
It could be some things:
Kerberos Authentication: Since your service A is self hosted, it sends the host crendential to Service B (on IIS). Try checking on Event viewer, on Application and Security tabs, if the users was logged ok. See if it using Kerberos or NTLM. If it goes back to Kerberos, check the SPN and if the user is trusted for delegation in Active Diretory.
Check if the assembly properly signed.
Check if the user (host A) has permission to acess the assembly you are trying to load.
User contributions licensed under CC BY-SA 3.0