AD 密码更改为 OrganizationService 后代理身份验证设置失败
Proxy Authentication settings fail after AD password change to OrganizationService
我曾经连接到这个测试应用程序,一周后我 return 现在遇到身份验证问题。在下方获取 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`
进一步调查表明,它似乎是环境问题,在我 运行 `PluginregistrationTool` 的跟踪下方,确认我在代码中遇到的异常 (但为什么?)
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)
...
代理保留来自 Active Directory 的用户名和密码,应该刷新,进行开发应该使用网络帐户*不会过期并且不会在任何时间段内更改密码的帐户。
我曾经连接到这个测试应用程序,一周后我 return 现在遇到身份验证问题。在下方获取 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`
进一步调查表明,它似乎是环境问题,在我 运行 `PluginregistrationTool` 的跟踪下方,确认我在代码中遇到的异常 (但为什么?)
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)
...
代理保留来自 Active Directory 的用户名和密码,应该刷新,进行开发应该使用网络帐户*不会过期并且不会在任何时间段内更改密码的帐户。