0

我正在尝试以这种方式连接到服务器 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:未授权。

4

0 回答 0