您无法将服务端点转换为webHttpBinding,因为Silverlight仅支持basicHttpBinding。为了保护您的Silverlight服务,您需要创建一个具有传输级安全性的basicHttpBinding。然后,创建一个指定httpsGetEnabled =“true”的服务行为。我已经包括下面的例子:
服务端的Web.config
<bindings>
<basicHttpBinding>
<binding name="SecureBasicHttpBinding" 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="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="MyService" behaviorConfiguration="SecureServiceBehavior">
<endpoint address="" binding="basicHttpBinding" contract="IMyService" bindingConfiguration="SecureBasicHttpBinding" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="SecureServiceBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
客户端
在客户端配置,从服务中添加相同SecureBasicHttpBinding然后添加以下终点属性:
bindingConfiguration="SecureBasicHttpBinding"