locked
How to get the QuickStart CRM SDK sample project to work? RRS feed

  • Question

  • I am trying to get the QuickStart sample to work and no matter which connection string style I use, all I get is some form of "Access is denied" error message.

    After entering the server, port, etc, I then get this error (note, it says it's using port 80 even though I entered :443 and said that I was using SSL):

    Metadata contains a reference that cannot be resolved: 'https://crmtest.domain.w
    in:80/CRM-TEST1-DB/XRMServices/2011/Organization.svc?wsdl'.
       at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.R
    etrieve(TimeoutHelper timeoutHelper)
       at System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(Resolve
    CallState resolveCallState)
       at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(Metadat
    aRetriever retriever)
       at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(Uri add
    ress, MetadataExchangeClientMode mode)
       at Microsoft.Xrm.Sdk.Client.ServiceMetadataUtility.RetrieveServiceEndpointMet
    adata(Type contractType, Uri serviceUri, Boolean checkForSecondary)
       at Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1..ctor(Uri serviceUri, Bool
    ean checkForSecondary)
       at Microsoft.Xrm.Sdk.Client.OrganizationServiceConfiguration..ctor(Uri servic
    eUri, Boolean enableProxyTypes, Assembly assembly)
       at Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateConfiguration[T
    Service](Uri serviceUri, Boolean enableProxyTypes, Assembly assembly)
       at Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateConfiguration[T
    Service](Uri serviceUri)
       at Microsoft.Xrm.Sdk.Client.ServiceProxy`1..ctor(Uri uri, Uri homeRealmUri, C
    lientCredentials clientCredentials, ClientCredentials deviceCredentials)
       at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy..ctor(Uri uri, Uri homeR
    ealmUri, ClientCredentials clientCredentials, ClientCredentials deviceCredential
    s)
       at Microsoft.Crm.Sdk.Samples.CRUDOperations.Main(String[] args) in c:\PROJECT
    S\CRMUpdate\trunk\CRMSDK\SampleCode\CS\QuickStart\CRUDOperations.cs:line 52

    The underlying connection was closed: An unexpected error occurred on a send.
       at System.Net.HttpWebRequest.GetResponse()
       at System.ServiceModel.Description.MetadataExchangeClient.MetadataLocationRet
    riever.DownloadMetadata(TimeoutHelper timeoutHelper)
       at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.R
    etrieve(TimeoutHelper timeoutHelper)

    The handshake failed due to an unexpected packet format.
       at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes
    , AsyncProtocolRequest asyncRequest)
       at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocol
    Request asyncRequest)
       at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToke
    n message, AsyncProtocolRequest asyncRequest)
       at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, A
    syncProtocolRequest asyncRequest)
       at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byt
    e[] buffer, AsyncProtocolRequest asyncRequest)
       at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyRes
    ult)
       at System.Net.TlsStream.CallProcessAuthentication(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionCo
    ntext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
    ontextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
    ontextCallback callback, Object state)
       at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
       at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
       at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
       at System.Net.ConnectStream.WriteHeaders(Boolean async)
    Press <Enter> to exit.

    Friday, August 21, 2015 1:35 AM

Answers

  • Turns out that a colleague had hard-coded :80 in some URLs in the deployment setup manager or whatever. The samples must query CRM to get some URLs back for certain things, and use those - not the ones you enter into the samples.
    • Marked as answer by mfearby Monday, August 24, 2015 1:33 AM
    Monday, August 24, 2015 1:33 AM