2017-10-12 87 views
0

昨日からコンソールアプリをデバッグしようとしましたが、成功しませんでした。私のスクリプトは投げつけ続けます:前提条件のDynamics 365メタデータに解決できない参照が含まれています。

メタデータには解決できない参照が含まれています: 'https://xxxxxxx/XRMServices/2011/Organization.svc?wsdl&sdkversion=8.2'。

xxxxxxxは、自分のcrmドメインのプレースホルダです。

私は、前提バージョン1612(8.2.0.749)(DB 8.2.0.749)のDynamics 365を使用しています。 Dynamics 365はIFDでした。

は、コンソールアプリケーションを作成するには、すでにI、

1)最新のダイナミクス365 SDKのバージョン8.2.1.1 Microsoft Dynamics 365 SDK

2)うん、また私のGACにこのSDKをインストールし使用します。次に、サーバーを再起動します。

3)私の組織のサービスのエンドポイントが正しい天気を確認するために、私は、また、ブラウザで私のOrganizationServiceエンドポイントアドレスhttps://xxxxxxx/XRMServices/2011/Organization.svcを貼り付け、そのことにより、作業のサービスを返します。**

4)私は、Visual Studio 2013を使用してmを。ネットフレームワーク4.5.2

ダイナミック365オンライントライアルを使用して奇妙なことはうまく動作します。

これは私のサンプルコードです:

static void Main(string[] args) 
     { 

      IOrganizationService organizationservice; 
      // Get the CRM connection string and connect to the CRM Organization 

      ClientCredentials Credentials = new ClientCredentials(); 
      Credentials.UserName.UserName = "username"; 
      Credentials.UserName.Password = "password"; 

      Credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials; 

      organizationservice = new OrganizationServiceProxy(
       new Uri("https://xxxxxxx/XRMServices/2011/Organization.svc"), null, Credentials, null); 

     } 

例外スロー: Exception throw:

詳細:事前に

System.InvalidOperationException was unhandled 
HResult=-2146233079 
Message=Metadata contains a reference that cannot be resolved: 
'https://xxxxxxx/XRMServices/2011/Organization.svc?wsdl&sdkversion=8.2'. 
Source=System.ServiceModel 
StackTrace: 
    at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper) 
    at System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(ResolveCallState resolveCallState) 
    at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(MetadataRetriever retriever) 
    at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(Uri address, MetadataExchangeClientMode mode) 
    at Microsoft.Xrm.Sdk.Client.ServiceMetadataUtility.RetrieveServiceEndpointMetadata(Type contractType, Uri serviceUri, Boolean checkForSecondary) 
    at Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1..ctor(Uri serviceUri, Boolean checkForSecondary) 
    at Microsoft.Xrm.Sdk.Client.OrganizationServiceConfiguration..ctor(Uri serviceUri, Boolean enableProxyTypes, Assembly assembly) 
    at Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateConfiguration[TService](Uri serviceUri, Boolean enableProxyTypes, Assembly assembly) 
    at Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateConfiguration[TService](Uri serviceUri) 
    at Microsoft.Xrm.Sdk.Client.ServiceProxy`1..ctor(Uri uri, Uri homeRealmUri, ClientCredentials clientCredentials, ClientCredentials deviceCredentials) 
    at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy..ctor(Uri uri, Uri homeRealmUri, ClientCredentials clientCredentials, ClientCredentials deviceCredentials) 
    at ConsoleConnectToCRM.Program.Main(String[] args) in d:\CRM2015\SSIS\TestCRMConnection\TestCRMConnection\Program.cs:line 45 
    at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) 
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) 
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
    at System.Threading.ThreadHelper.ThreadStart() 
    InnerException: System.Net.WebException 
    HResult=-2146233079 
    Message=The underlying connection was closed: An unexpected error occurred on a receive. 
    Source=System 
    StackTrace: 
     at System.Net.HttpWebRequest.GetResponse() 
     at System.ServiceModel.Description.MetadataExchangeClient.MetadataLocationRetriever.DownloadMetadata(TimeoutHelper timeoutHelper) 
     at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper) 
    InnerException: System.ComponentModel.Win32Exception 
     HResult=-2147467259 
     Message=The client and server cannot communicate, because they do not possess a common algorithm 
     Source=System 
     ErrorCode=-2147467259 
     NativeErrorCode=-2146893007 
     StackTrace: 
      at System.Net.SSPIWrapper.AcquireCredentialsHandle(SSPIInterface SecModule, String package, CredentialUse intent, SecureCredential scc) 
      at System.Net.Security.SecureChannel.AcquireCredentialsHandle(CredentialUse credUsage, SecureCredential& secureCredential) 
      at System.Net.Security.SecureChannel.AcquireClientCredentials(Byte[]& thumbPrint) 
      at System.Net.Security.SecureChannel.GenerateToken(Byte[] input, Int32 offset, Int32 count, Byte[]& output) 
      at System.Net.Security.SecureChannel.NextMessage(Byte[] incoming, Int32 offset, Int32 count) 
      at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) 
      at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest) 
      at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) 
      at System.Net.TlsStream.CallProcessAuthentication(Object state) 
      at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback 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) 
     InnerException: 

感謝。

+0

Microsoft.Xrm.Tooling.Connectorを利用することができます。https://msdn.microsoft.com/en-us/library/dn689019.aspx – Alex

+0

ありがとうございます。ありがとうございます。Microsoft.Xrm.Client.dllは推奨されていません、まだ使用することができます。奇妙なことは、上記のコードと同じコードを使用してCRMサーバでコンソールアプリケーションを実行したときです。ただし、DBサーバー内で実行すると、同じ例外が返されます。私はそこに私のDBサーバーのどこかに間違っていると思っています。 WEIRD。 – xChaax

答えて

1

この問題は、クライアントコンピュータがHTTP要求を送信できない場合に発生します。接続が閉じられているか使用できないため、クライアントコンピュータはHTTP要求を送信できません。そして今日私のDBサーバーはTLS1.2で、SSLをCRMアプリケーションサーバーに接続するプロトコルとして使用していたので、console app経由でDBからCRMに接続するときは、明示的にServicePointManagerのTLSバージョンを設定する必要があります。 CRM組織サービスへの呼び出しを行う前に、いつでもこのコードを実行してください。

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 

将来的にはこれが恩恵を受けると思います。

0

アプリケーションをCRM365にアップグレードしたとき、接続の方法を変更する必要がありました。これは私が使用しているものです

これは前提ではないので、私はうまくいかないと思います。ただし、接続文字列にAuthTypeを指定する必要があり、接続にCrmServiceClientを使用する必要があります。

+0

おかげでスティーブ、ええオンラインバージョンのために働いています。私は前提で試したが、役に立たなかった。私はそこに何か私のDBサーバーのCRMに原因が間違っていると思うそこに実行するコンソールアプリケーションのような問題はありませんでした。 – xChaax

0

crmバージョン2011以降ではIServiceManagementを使用しています。 F#の例を以下に示します。これはほぼそのままC#に変換されます。

let authenticate uri username password domain = 
    let m = ServiceConfigurationFactory.CreateManagement<IOrganizationService(uri) 
    let cred = AuthenticationCredentials() 
    cred.ClientCredentials.Windows.ClientCredential <- 
    new NetworkCredential(username, password, domain) 
    let ac = m.Authenticate(cred) 
    let proxy = new OrganizationServiceProxy(m, ac.ClientCredentials) 
    proxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior()); 
    proxy 
+0

ありがとう、接続のセットアップの方法がここで問題を引き起こすとは思わないでください。私のDBサーバーに何か問題があるのではないかと心配しています。私のCRMサーバーのコンソールアプリケーションと同じコードを使用しています。 – xChaax

関連する問題