I need to connect to an ASMX secured web service over HTTPS using Silverlight 4. I have been able to connect to the service using a WPF application using the following configuration:
<binding name="wsSomeWebService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="Basic" proxyCredentialType="Basic"
realm="www.somedomain.com" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
And in code I do the following:
client.ClientCredentials.UserName.UserName = "username";
client.ClientCredentials.UserName.Password = "password";
However, when I try to connect from Silverlight I always get a security exception.
On the server the policy file looks like this:
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-methods="*" http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
On Silverlight, I have tried using this:
<customBinding>
<binding name="secureBinaryHttpBinding" >
<security authenticationMode="UserNameOverTransport"/>
<httpsTransport />
</binding>
</customBinding>
And also this:
<basicHttpBinding>
<binding name="basicSecureBinding" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="Transport"/>
</binding>
</basicHttpBinding>
But neither seems to work.
Does anyone have an idea on how I can reproduce the successful configuration I used in WPF on a Silverlight client?