I used to connect to this testing application, a week later I return and have now issues authenticating. Getting a System.InvalidOperationException
details below
(Exception e) {
e.Message = "Metadata contains a reference that cannot be resolved: 'https://ORGNAME.crm4.dynamics.com/XRMServices/2011/Organization.svc?wsdl'."
e.InnerException = "The remote server returned an error: (407) Proxy Authentication Required."
e.InnerException.InnerException = "The logon attempt failed."
}
since I am on the domain and need the proxy to see the Organization.svc
I have the following in App.config to cater for this:
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true">
<proxy bypassonlocal="True" proxyaddress="http://PROXYURI:8080" />
</defaultProxy>
</system.net>
<connectionStrings>
<!-- using online -->
<add name="Server=CRM Online, organization=contoso,user=someone" connectionString="Url=https://contoso.crm.dynamics.com;[email protected]; Password=password;"/>
</connectionStrings>
I can browse to the Organization.svc?wsdl using the browser. but not in Code c#:
// Establish a connection to the organization web service (using the above connection string).
var connection = CrmConnection.Parse(ConfigurationManager.ConnectionStrings[1].ConnectionString);
using (_orgService = new OrganizationService(connection))
{
...
var context = new OrganizationServiceContext(_orgService);
//than as soon as I use _orgService I get the Exception
List<Contact> firstNameContacts = (from c in context.CreateQuery<Contact>()
where c.FirstName == "Shane"
select c).ToList();
...
}
like I say nothing has changed since I last used it to connect to online MSCRM 2015 service, but for a password reset on the domain (see my comment confirming this is the issue old password seemed to be cashed only when creating the service call in code).
`Edit`
further investigation shows that it seems to be environmental, below the trace when I run the `PluginregistrationTool`, confirming the exceptions I am getting in code (BUT WHY?)
Inner Exception<b> Level 1:</b>
Source : System
Method : GetResponse
Error : `The remote server returned an error: (407) Proxy Authentication Required.`
Stack Trace : at System.Net.HttpWebRequest.GetResponse()
...
Source : System.serviceModel
Method : Retrieve
Error : Metadata contains a reference that cannot be resolved: 'https://dev.crm4.dynamics.com/XRMServices/2011/Discovery.svc?wsdl'.
...
Inner Exception <b>Level 1</b>:
Source : System
Method : GetResponse
Error : `The remote server returned an error: (407) Proxy Authentication Required.`
Stack Trace : at System.Net.HttpWebRequest.GetResponse()
...
Inner Exception <b>Level 2</b> :
Source : System
Error : `The logon attempt failed`
Stack Trace : at System.Net.NTAuthentication.GetOutgoingBlob(Byte[] incomingBlob, Boolean throwOnError, SecurityStatus& statusCode)
...
Proxy keeps username and passwords from Active Directory and should be flushed, Doing development one should use network accounts *Accounts that does not expire and would not change passwords over any period of time.