crm 4.0 crmservice如何连接远程服务器?

时间:2013-07-05 10:11:56

标签: dynamics-crm crm dynamics-crm-4

我正试图以这种方式连接到服务器crm:

CrmService crmService = new CrmService();
crmService.PreAuthenticate = true;
Shareremover.CrmSdk.CrmAuthenticationToken token = new CrmSdk.CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = Shareremover.Properties.Settings.Default.organization;
crmService.CrmAuthenticationTokenValue = token;
crmService.Url = http : //bfitcrm/MSCrmServices/2007/CrmService.asmx
//crmService.UnsafeAuthenticatedConnectionSharing = true;   


if(String.Empty != Shareremover.Properties.Settings.Default.login.Trim() && String.Empty != Shareremover.Properties.Settings.Default.password.Trim() && String.Empty != Shareremover.Properties.Settings.Default.domain.Trim())
{
    crmService.Credentials = new System.Net.NetworkCredential(Shareremover.Properties.Settings.Default.login,Shareremover.Properties.Settings.Default.password,Shareremover.Properties.Settings.Default.domain);
    crmService.Execute(Rrequest);
}
else
{
    crmService.Credentials = System.Net.CredentialCache.DefaultCredentials;
}   

crmService.Execute(Rrequest);

我有以下错误:

  

请求失败,HTTP状态为401:未经授权。

0 个答案:

没有答案