我以前连接到这个测试应用程序,一周后我返回并且现在发布了身份验证问题。获取下面的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。但不在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();
...
}
就像我说自从我上次使用它连接到在线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)
...
答案 0 :(得分:0)
代理保留Active Directory中的用户名和密码,应刷新,执行开发应使用网络帐户*不会过期且不会在任何时间段内更改密码的帐户。