调用者未通过服务错误验证 - 通过SSL调用CRM 2011部署wcf服务方法?

时间:2011-09-15 05:36:56

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

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

当我使用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证书已安装在服务器上,网站可以在任何网络浏览器中通过SSL浏览。我需要哪些其他证书以及为什么?)

此外,IIS设置已根据需要进行。 WCf服务可通过网络浏览器通过SSL / https浏览。)我尝试过匿名身份验证以及通过服务器上的域用户进行身份验证,并在代码中处理相同的内容。

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

1 个答案:

答案 0 :(得分:-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:)