Dear All !
I have code Winform C# connect to CRM. But It OK in my computer and window server CRM, It throw exception in orther clients.
help me because I don't know cause of it.
This is my code :
private void Connect(string server, string org, string domain, string user, string pass)
{
try
{
string url = "http://" + server + "/" + org + "/XRMServices/2011/Organization.svc";
Uri OrganizationUri = new Uri(url);
ClientCredentials Credentials = new ClientCredentials();
Credentials.Windows.ClientCredential = new System.Net.NetworkCredential(user, pass, domain);
serviceProxy = new OrganizationServiceProxy(OrganizationUri, null, Credentials, null);
serviceProxy.EnableProxyTypes();
service = (IOrganizationService)serviceProxy;
CheckConnection();
}
catch (Exception ex)
{
MethodBase method = System.Reflection.MethodBase.GetCurrentMethod();
string fullMethodName = Logfile.getFullMethodNameAndParam(method);
Logfile.Write(fullMethodName, ex.StackTrace, string.Empty);
throw new Exception("Kết nối CRM bị lỗi " + ex.Message);
}
and this is 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 IVG.ConnectCRM.CrmConnector.Connect(String server, String org, String domain, String user, String pass)
*This post is locked for comments