我需要我的网站连接到CRM这是我的代码
var organizationUri = new Uri(ConfigurationManager.AppSettings["CRMServerUrl"]);
//Client credentials
var credentials = new ClientCredentials();
credentials.UserName.UserName = @"<user>";
credentials.UserName.Password = "<password>";
// Use the Microsoft Dynamics CRM Online connection string from the web.config file named "CrmConnectionStr".
using (OrganizationServiceProxy _service = new OrganizationServiceProxy(organizationUri, null, credentials, null))
{
Response.Write("Connected");
}
Run Code Online (Sandbox Code Playgroud)
这是在我的web.config中
<add key="CRMServerUrl" value="http://XXXXX/XRMServices/2011/Organization.svc" />
<add key="username" value="<user>" />
<add key="password" value="<password>" />
Run Code Online (Sandbox Code Playgroud)
它给了我这个错误信息:
"发生了严重错误.无法与CRM服务器连接.调用者未通过该服务进行身份验证."