调用 CRM 2013 Web 服务时出现拒绝访问错误
Access Denied Error in calling CRM 2013 Web Service
我有一个简单的控制台应用程序,用于测试连接到 MS Dynamics CRM。
MS Dynamics CRM 2011 一切正常,但调用 2013 或更高版本时,会引发 "Access is denied" 错误。
我的源代码是:
static void Main(string[] args)
{
try
{
OrganizationServiceProxy _orgService;
Uri uri = new Uri("http://mycrm.mylab.com/XRMServices/2011/Organization.svc");
System.ServiceModel.Description.ClientCredentials clientCredentials = new System.ServiceModel.Description.ClientCredentials();
clientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("myuser@mylab.com", "mypsw", "mylab.com");
OrganizationServiceProxy orgService = new OrganizationServiceProxy(uri, null, clientCredentials, null);
QueryExpression query = new QueryExpression("systemuser");
query.ColumnSet = new ColumnSet(new string[] { "systemuserid" });
query.Criteria = new FilterExpression();
orgService.RetrieveMultiple(query);
}
catch (Exception ex)
{
}
}
CRM 2011 和 2013 中的 username/paswword 和安全角色是相同的。
任何人都可以帮助我吗?
虽然可以通过它的 uri 访问 crm 服务,但是无法通过 OrganizationServiceProxy 访问代码中的 Retrive 方法。
我将组织名称添加到我的 uri 地址:
uri uri = new Uri("http://mycrm.mylab.com/MYORGANIZATION/XRMServices/2011/Organization.svc");
有效!
我有一个简单的控制台应用程序,用于测试连接到 MS Dynamics CRM。 MS Dynamics CRM 2011 一切正常,但调用 2013 或更高版本时,会引发 "Access is denied" 错误。 我的源代码是:
static void Main(string[] args)
{
try
{
OrganizationServiceProxy _orgService;
Uri uri = new Uri("http://mycrm.mylab.com/XRMServices/2011/Organization.svc");
System.ServiceModel.Description.ClientCredentials clientCredentials = new System.ServiceModel.Description.ClientCredentials();
clientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("myuser@mylab.com", "mypsw", "mylab.com");
OrganizationServiceProxy orgService = new OrganizationServiceProxy(uri, null, clientCredentials, null);
QueryExpression query = new QueryExpression("systemuser");
query.ColumnSet = new ColumnSet(new string[] { "systemuserid" });
query.Criteria = new FilterExpression();
orgService.RetrieveMultiple(query);
}
catch (Exception ex)
{
}
}
CRM 2011 和 2013 中的 username/paswword 和安全角色是相同的。 任何人都可以帮助我吗?
虽然可以通过它的 uri 访问 crm 服务,但是无法通过 OrganizationServiceProxy 访问代码中的 Retrive 方法。
我将组织名称添加到我的 uri 地址:
uri uri = new Uri("http://mycrm.mylab.com/MYORGANIZATION/XRMServices/2011/Organization.svc");
有效!