AD 密码更改为组织服务后,代理身份验证设置失败



我曾经连接到这个测试应用程序,一周后我回来了,现在身份验证问题。获取以下System.InvalidOperationException详细信息

(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."
}

因为我在域上并且需要代理才能查看Organization.svc所以我在 App.config 中有以下内容来满足这一点:

<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;Username=someone@contoso.onmicrosoft.com; Password=password;"/>
</connectionStrings>

我可以使用浏览器浏览到 Organization.svc?wsdl。 但不是在代码 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();

  ...
}

就像我说的那样,自从我上次使用它连接到在线MSCRM 2015服务以来,没有任何变化,但是对于域的密码重置(请参阅我的评论,确认这是旧密码的问题,似乎仅在创建代码中的服务调用时兑现)。

 `Edit`

进一步的调查表明,当我运行"插件注册工具"时,它似乎是环境性的,低于跟踪,确认我在代码中遇到的异常(但为什么?

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)
    ...

代理保留来自活动目录的用户名和密码,应刷新,进行开发时应使用网络帐户 *不会过期且在任何时间段内都不会更改密码的帐户。

最新更新