开发者

Problem using crmsvcutil to generate data context class

开发者 https://www.devze.com 2023-03-06 18:08 出处:网络
I am trying 开发者_运维百科to retrieve data from Microsoft Dynamics CRM database. In order to have LINQ functionality, I applied crmsvcutil to generate data context class. The following is the command

I am trying 开发者_运维百科to retrieve data from Microsoft Dynamics CRM database. In order to have LINQ functionality, I applied crmsvcutil to generate data context class. The following is the command line I used

crmsvcutil /connectionString:"Authentication Type=SPLA; Server= http://our-crm.com; User ID=user; Password=pass" /namespace:Stub.Xrm /dataContextPrefix:MyCorp /out:Xrm.cs

When running the command, I got

Unhandled Exception: System.Net.WebException: The request failed with HTTP status 401: Unauthorized.

Error. I was able to access http://our-crm.com by using user/pass to assess the CRM. I am suspecting that the URL of serer was the problem, but don't know exactly which one I should use.

The CRM version I used is 4.0

UPDATE On May 19, 2011: I changed the connection string to

crmsvcutil /connectionString:"Authentication Type=AD; Server= http://our-crm.com/CRM; User ID=domain\user; Password=pass" /namespace:Stub.Xrm /dataContextPrefix:MyCorp /out:Xrm.cs

Now I am getting

Unhandled Exception: System.ApplicationException:   0x80040220
  SecLib::CheckPrivilege failed. Returned hr = -2147220960, User: f26255aa-997a-e011-b1ff-0050569e0924, PrivilegeId: a33
11f47-2134-44ee-a258-6774018d4bc3

Does it mean I do not have enough privilege to retrieve WSDL information? But I was able to use browser to get http://our-crm.com/mscrmservices/2007/CrmServiceWsdl.aspx and I was able to add webreference to the WebService using same credential.


If you are accessing Dynamics CRM OnPremise with the credentials of the current user, you have to specify Integratedas authentication type.

Therefore your connection string should be

/connectionString:"Authentication Type=Integrated; Server= http://our-crm.com; 

If you have to specify a specific user, you have to use AD

/connectionString:"Authentication Type=AD; Server= http://our-crm.com; User ID=user-domain\user-name; Password=user-password

See Connect to the Microsoft Dynamics CRM Server

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号