2011-02-18 97 views
0

我有一个带有SSL服务的silverlight应用程序。如果我部署没有SSL的服务,所有的工作都正常,但是如果我激活SSL并在servicereference.clientconfig中将端点从http://MyService更改为https://MyService,并将web.config中的端点从0122转换为“webHttpBinding” 服务不工作,并产生下一个错误:在SSL中部署WCF服务和silverlight

Unhandled error in silverlight Application [Arg_NullReferenceException] 
Arguments: debbuging resource string ar unavalible 

我不知道什么是错的还是我需要做更多的东西......等提前向大家 谢谢,我需要帮助。

回答

0

您无法将服务端点转换为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"