我需要使用Silverlight4通过HTTPS连接到ASMX安全的web服务。我已经能够通过使用以下配置的WPF应用程序连接到服务:
<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>
client.ClientCredentials.UserName.UserName = "username";
client.ClientCredentials.UserName.Password = "password";
但是,当我尝试从Silverlight连接时,总是会遇到一个安全异常。
<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>
在Silverlight上,我尝试使用以下方法:
<customBinding>
<binding name="secureBinaryHttpBinding" >
<security authenticationMode="UserNameOverTransport"/>
<httpsTransport />
</binding>
</customBinding>
还有这个:
<basicHttpBinding>
<binding name="basicSecureBinding" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="Transport"/>
</binding>
</basicHttpBinding>
有人知道如何在Silverlight客户机上复制WPF中使用的成功配置吗?