尝试从昨天开始调试我的控制台应用程序,但没有成功。我的脚本不断抛出:
元数据包含无法解析的引用:' 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。
要创建控制台应用程序,我已经,
1) 使用最新的dynamics 365 Sdk 版本8.2.1.1 Microsoft Dynamics 365 SDK
2)是的,也将这个sdk安装到我的GAC中。然后重新启动我的服务器。
3)为了检查我的组织服务端点是否正确,我还将我的组织服务端点地址粘贴https://xxxxxxx/XRMServices/2011/Organization.svc
到浏览器中,并通过返回服务来工作。**
4)我正在使用 Visual Studio 2013,.net 框架 4.5.2
使用 Dynamics 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);
}
细节:
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:
提前致谢。