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