【问题标题】:Caller was not authenticated by the service error - CRM 2011 Deployment wcf service method call over SSL?调用者未通过服务错误进行身份验证 - CRM 2011 部署 wcf 服务方法调用 SSL?
【发布时间】:2011-11-17 14:00:00
【问题描述】:

我正在尝试在定制的 vb.net 应用程序中使用 CRM 2011 部署服务进行 CRM 2011 管理请不要告诉我我应该使用部署管理器进行我的操作,因为我必须根据我的组织的特定要求开发这个自定义应用程序。

当我使用 http 时一切正常,但当我尝试使用 SSL 连接调用部署服务方法时(在服务器上启用了 HTTPS)

这是我仅针对 HTTPS/SSL 的相关客户端配置

<binding name="CustomBinding_IDeploymentServiceHttps">
      <security defaultAlgorithmSuite="Default" authenticationMode="SspiNegotiatedOverTransport"
                    requireDerivedKeys="false" securityHeaderLayout="Strict" includeTimestamp="true"
                    keyEntropyMode="CombinedEntropy" protectTokens="false" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"
                    requireSecurityContextCancellation="true">
        <localClientSettings cacheCookies="true" detectReplays="false"
            replayCacheSize="900000" maxClockSkew="00:05:00" maxCookieCachingTime="Infinite"
            replayWindow="00:05:00" sessionKeyRenewalInterval="10:00:00"
            sessionKeyRolloverInterval="00:05:00" reconnectTransportOnFailure="true"
            timestampValidityDuration="00:05:00" cookieRenewalThresholdPercentage="60" />
        <localServiceSettings detectReplays="false" issuedCookieLifetime="10:00:00"
            maxStatefulNegotiations="128" replayCacheSize="900000" maxClockSkew="00:05:00"
            negotiationTimeout="00:01:00" replayWindow="00:05:00" inactivityTimeout="00:02:00"
            sessionKeyRenewalInterval="15:00:00" sessionKeyRolloverInterval="00:05:00"
            reconnectTransportOnFailure="true" maxPendingSessions="128"
            maxCachedCookies="1000" timestampValidityDuration="00:05:00" />
        <secureConversationBootstrap />
      </security>
      <textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
          messageVersion="Default" writeEncoding="utf-8">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      </textMessageEncoding>
      <httpsTransport manualAddressing="false" maxBufferPoolSize="524288"
          maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
          bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
          realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
          useDefaultWebProxy="true" requireClientCertificate="false" />
    </binding>

 <client>
  <!-- Deployment Service Endpoints HTTP,HTTPS-->
  <endpoint address="http://10.40.30.20:5555/XRMDeployment/2011/Deployment.svc"
    binding="customBinding" bindingConfiguration="CustomBinding_IDeploymentService"
    contract="CRM2011DeploymentSvc.IDeploymentService" name="CustomBinding_IDeploymentService">
    <identity>
      <userPrincipalName value="LAB2010\administrator" />
    </identity>
  </endpoint>
  <endpoint address="https://www.mydomain.com/XRMDeployment/2011/Deployment.svc"
            binding="customBinding" bindingConfiguration="CustomBinding_IDeploymentServiceHttps"
            contract="CRM2011DeploymentSvc.IDeploymentService" name="CustomBinding_IDeploymentServiceHttps" />
</client>

我在我的 asp.net 应用程序中使用以下代码

Dim DomainCredentials As New NetworkCredential(ADUserName, ADPassword, DomainNETBIOS)
 If CRMDeploymentServiceURl.Trim().ToLower().StartsWith("https://") Then
            _CrmDeployService = New DepSvc.DeploymentServiceClient("CustomBinding_IDeploymentServiceHttps")
        Else
            _CrmDeployService = New DepSvc.DeploymentServiceClient("CustomBinding_IDeploymentService")
        End If
        _CrmDeployService.ClientCredentials.Windows.ClientCredential = DomainCredentials
        _CrmDeployService.Endpoint.Address = New EndpointAddress(New Uri(CRMDeploymentServiceURl))
        _CrmDeployService.Endpoint.Binding.CloseTimeout = New TimeSpan(0, 30, 0)
        _CrmDeployService.Endpoint.Binding.OpenTimeout = New TimeSpan(0, 30, 0)
        _CrmDeployService.Endpoint.Binding.ReceiveTimeout = New TimeSpan(0, 30, 0)
        _CrmDeployService.Endpoint.Binding.SendTimeout = New TimeSpan(0, 30, 0)

以上代码仅用于服务的初始化。稍后当我使用调用方法时 _CrmDeployService 对象,在 http 上一切正常,但在 https 上不行

请告诉我如何在不使用任何客户端证书的情况下与 HTTPS 安全部署服务进行通信。 (来自 DigiCert 的 SSL 证书已安装在服务器上,并且可以在任何 Web 浏览器中通过 SSL 浏览网站。我还需要什么其他证书,为什么?)

IIS 设置也已根据需要完成。 WCf 服务可通过 Web 浏览器通过 SSL/https 浏览。)我已经尝试过匿名身份验证以及通过服务器上的域用户进行身份验证,并且在代码中也进行了相同的处理。

我需要进行任何配置更改吗?这是 WCF 的特定问题吗?我已经尝试过在 stackoverflow 和 msdn 上发布的解决方案,但无济于事。 我无法更改服务器的 web.config 并且我不能使用客户端证书,但我可以使用身份验证所需的任何凭据,并且我必须通过 SSL 实现它。请帮助。谢谢

【问题讨论】:

    标签: wcf deployment service ssl dynamics-crm-2011


    【解决方案1】:

    SSL 意味着它将需要证书。首先通过制作任何示例应用程序来检查 WCF 是否使用 ssl 进行检查,因为只有这样才能确定 CRM 服务器是问题所在(它正在寻找证书),或者更糟糕的是,您在到达之前被 WCF 提前失败了那一点。如果 WCF 失败了,那么您必须为其创建一个临时证书。互联网上有很多帮助代码可以帮助您入门。

    http://msdn.microsoft.com/en-us/library/ff648498.aspx

    在您的应用程序中,使用以下绑定(如果您愿意,可以使用不同的传输/消息安全模式):

    <basicHttpBinding>
    <binding name="basicHttp">
    <security mode="TransportWithMessageCredential" >
    <transport/>
    <message clientCredentialType=”UserName”/>
    </security>
    </binding>
    </basicHttpBinding>
    

    您还必须配置 iis。您必须在 iis 中启用 https 并分配我认为在 Directory Security | Server Certificate.

    中的证书

    如果它是一个 Silverlight 应用程序,那么它将需要更多的额外开发。 快乐编码 Machpanel:)

    【讨论】:

    • SSL 证书已安装在服务器上。我还需要什么证书? IIS 设置也已根据需要完成。 WCF 可通过 Web 浏览器通过 SSL/htps 浏览。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-09-22
    • 2013-08-21
    • 1970-01-01
    • 2018-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多