【问题标题】:Deploying WCF service and silverlight in SSL在 SSL 中部署 WCF 服务和 silverlight
【发布时间】:2011-02-18 12:29:16
【问题描述】:

我有一个带有 SSL 服务的 silverlight 应用程序。如果我在没有 SSL 的情况下部署服务一切正常,但如果我激活 SSL 并将 servicereference.clientconfig 中的端点从 http://MyService 更改为 https://MyService,并在 web.config 中进行更改: 从“basicHttpBinding”到“webHttpBinding”的端点 该服务不工作并产生下一个错误:

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

我不知道是不是出了什么问题,或者我需要做更多的事情......等等。 提前感谢所有我需要帮助的人。

【问题讨论】:

    标签: silverlight wcf ssl


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多