Quantcast
Channel: Forum CRM Development
Viewing all articles
Browse latest Browse all 1000

Exceptions trying to retrieve a list of CRM organizations

$
0
0

Hi! I'm trying to retrieve a list of the CRM orgs existing in a CRM server. I can accomplish thatJUST in the CRM server AND logging as a deployment admin with this code.

System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
DeploymentServiceClient serviceClient = Microsoft.Xrm.Sdk.Deployment.Proxy.ProxyClientHelper.CreateClient(new Uri("https://myServer:443/XRMDeployment/2011/Deployment.svc"));
var organizations = serviceClient.RetrieveAll(DeploymentEntityType.Organization);

The problem comes when I try to add Credentials to the service as:

serviceClient.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential();
                serviceClient.ClientCredentials.Windows.ClientCredential.UserName = "DOMAIN\user";
                serviceClient.ClientCredentials.Windows.ClientCredential.Password = "pass";
                serviceClient.ClientCredentials.Windows.ClientCredential.Domain = "domain.local";

it always throw me: 

SOAP security negotiation with 'https://myServer/XRMDeployment/2011/Deployment.svc' for target 'https://myServer/XRMDeployment/2011/Deployment.svc' failed.

So, next I tried is add the UPN in web.config.

<servicePrincipalName><system.serviceModel><client><endpoint><identity><userPrincipalName value="domain\user" /></identity></endpoint></client></system.serviceModel></servicePrincipalName>

But now I get this exception:

The type initializer for 'System.Net.ServicePointManager'

Which I can't find much information about.

1. If I want my app to be used externally from the CRM server, how can I add the credentials to the service?





Viewing all articles
Browse latest Browse all 1000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>