We have crm 2011 and IFD installed and working. We are deploying some code that will update records.
we are gettting the following error message
The authentication endpoint Username was not found on the configured Secure Token Service!
Here is a sample of our code
/// <summary>
/// Get a connection to the CRM service proxy.
/// </summary>
/// <returns></returns>
private OrganizationServiceProxy GetCRMService()
{
string crmUserName = String.Empty;
string crmUserPassword = String.Empty;
try
{
MiscFunctions.ReportTimer("GetCRMService - Start");
if (serviceProxy == null)
{
//Service URLs will come from app.config for RDC and web.config/rdmp.config for RDCWeb
Uri OrgUri = new Uri(ConfigurationManager.AppSettings["CRMServiceURL"]);
Uri DiscoUri = new Uri(ConfigurationManager.AppSettings["CRMDiscoveryURL"]);
ClientCredentials localCredentials = new ClientCredentials();
ClientCredentials deviceCredentials = new ClientCredentials();
// Use a delegate user...
if (ConfigurationManager.AppSettings["Outlook Location"] == "online")
{
crmUserName = String.Format(@"{0}\{1}",
ConfigurationManager.AppSettings["CRMDomain"], ConfigurationManager.AppSettings["CRMUser"]);
crmUserPassword = ConfigurationManager.AppSettings["CRMPassword"];
#if !DEBUG
//TODO - Remove this from release build...
ErrorTrack.WriteMessage("UpdateOffline", "GetCRMService", String.Format("User: {0} | Password: {1}", crmUserName, crmUserPassword), false);
#endif
localCredentials.UserName.UserName = crmUserName;
localCredentials.UserName.Password = crmUserPassword;
}
// Create the service...
serviceProxy = new OrganizationServiceProxy(OrgUri, DiscoUri, localCredentials, deviceCredentials);
// Return the service...
}
MiscFunctions.ReportTimer("GetCRMService - End");
return serviceProxy;
}
catch (Exception ex)
{
ErrorTrack.WriteMessage(ex, "GetCRMService", true);
return null;
}
}
This appears to return a service proxy...
but this method fails:
public bool AddStoreVisit(Guid StoreVisitID, Guid StoreID, String Name, DateTime TimeStart, DateTime TimeEnd, String StoreVisitBy, int VisitType, string RDCVersion)
{
try
{
MiscFunctions.InitTimer();
if (IsOutLookReady())
{
MiscFunctions.ReportTimer("AddStoreVisit - Start");
OrganizationServiceProxy service = GetCRMService();
Entity sv = new Entity("cmg_storevisit");
sv.Id = StoreVisitID;
sv["cmg_name"] = Name;
sv["cmg_storeid"] = new EntityReference("cmg_store", StoreID);
if (TimeStart > DateTime.MinValue)
sv["cmg_storevisitdate"] = TimeStart;
if (TimeEnd > DateTime.MinValue)
sv["cmg_storevisitend"] = TimeEnd;
sv["cmg_storevisitedby"] = StoreVisitBy;
sv["cmg_storevisittype"] = VisitType;
sv["cmg_rdcversion"] = RDCVersion;
try
{
service.Create(sv);
}
catch (System.Web.Services.Protocols.SoapException ex)
{
ErrorTrack.WriteMessage("UpdateOffline", "AddStoreVisit(SoapFault)", ex.Message + ":" + ex.Detail.OuterXml, true);
return false;
}
catch (Exception exSave)
{
ErrorTrack.WriteMessage("UpdateOffline", "AddStoreVisit", exSave.Message, true); <--******* THIS IS THE ERROR CATCH
return false;
}
return true;
}
else
{
return false;
}
}
catch (System.Web.Services.Protocols.SoapException sex)
{
ErrorTrack.WriteMessage(sex, "AddStoreVisit", true);
return false;
}
catch (Exception ex)
{
ErrorTrack.WriteMessage(ex, "AddStoreVisit", true);
return false;
}
}
Our code works when we do it in offline mode, but not on the CRM server.
we have tried the suggested fix described here: http://www.thinketg.com/Company/Blogs/11-10-25/CRM_2011_Authentication_Endpoint_Not_Found_Error_Resolution.aspx
but the error remains. Most of the suggested fixes I find are in relation to the e-mail router or the outlook client, and I am not having any issue connecting either of these the the environment, so I know the discovery service works.
If we comment out the setting of the localcredentials like so:
//Service URLs will come from app.config for RDC and web.config/rdmp.config for RDCWeb
Uri OrgUri = new Uri(ConfigurationManager.AppSettings["CRMServiceURL"]);
Uri DiscoUri = new Uri(ConfigurationManager.AppSettings["CRMDiscoveryURL"]);
ClientCredentials localCredentials = new ClientCredentials();
ClientCredentials deviceCredentials = new ClientCredentials();
// Use a delegate user...
if (ConfigurationManager.AppSettings["Outlook Location"] == "online")
{
crmUserName = String.Format(@"{0}\{1}",
ConfigurationManager.AppSettings["CRMDomain"], ConfigurationManager.AppSettings["CRMUser"]);
crmUserPassword = ConfigurationManager.AppSettings["CRMPassword"];
//localCredentials.UserName.UserName = crmUserName;
//localCredentials.UserName.Password = crmUserPassword;
}
// Create the service...
serviceProxy = new OrganizationServiceProxy(OrgUri, DiscoUri, localCredentials, deviceCredentials);
we now get: The authentication endpoint Kerberos was not found on the configured Secure Token Service!