CRM 2011 Dicovery服务故障异常
我在一次会议上问了同样的问题,但没有得到答案。因此,我将再次尝试stackoverflow 我正在运行crm 2011培训工具包中的示例代码CRM 2011 Dicovery服务故障异常,crm,dynamics-crm-2011,Crm,Dynamics Crm 2011,我在一次会议上问了同样的问题,但没有得到答案。因此,我将再次尝试stackoverflow 我正在运行crm 2011培训工具包中的示例代码 var creds = new ClientCredentials(); var dsp = new DiscoveryServiceProxy( dinfo, creds); dsp.Authenticate(); var orgRequest = new RetrieveOrganizationRequest(); var response
var creds = new ClientCredentials();
var dsp = new DiscoveryServiceProxy( dinfo, creds);
dsp.Authenticate();
var orgRequest = new RetrieveOrganizationRequest();
var response = dsp.Execute(orgRequest);
var orgResponse = response as RetrieveOrganizationsResponse;
if (orgResponse != null)
comboOrgs.ItemsSource = orgResponse.Details;
在var response=dsp.Execute(orgRequest)行中,我得到了FaltException`1,详细消息如下
System.ServiceModel.FaultException`1 was unhandled
Message=organizationName
Source=mscorlib
Action=http://schemas.microsoft.com/xrm/2011/Contracts/Discovery/IDiscoveryService/ExecuteDiscoveryServiceFaultFault
StackTrace:
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Xrm.Sdk.Discovery.IDiscoveryService.Execute(DiscoveryRequest request)
at Microsoft.Xrm.Sdk.Client.DiscoveryServiceProxy.Execute(DiscoveryRequest request)
我可以使用浏览器访问Discovery.svc文件。所以服务器url应该是正确的。这是身份验证问题吗?这是针对Microsoft CRM Online还是内部部署的?对于在线,我知道您希望使用SDK中的一些东西-
// Connect to the Discovery service.
// The using statement assures that the service proxy will be properly disposed.
using (DiscoveryServiceProxy _serviceProxy = new DiscoveryServiceProxy(serverConfig.DiscoveryUri,
serverConfig.HomeRealmUri,
serverConfig.Credentials,
serverConfig.DeviceCredentials))
{
// You can choose to use the interface instead of the proxy.
IDiscoveryService service = _serviceProxy;
#region RetrieveOrganizations Message
// Retrieve details about all organizations discoverable via the
// Discovery service.
RetrieveOrganizationsRequest orgsRequest =
new RetrieveOrganizationsRequest()
{
AccessType = EndpointAccessType.Default,
Release = OrganizationRelease.Current
};
RetrieveOrganizationsResponse organizations =
(RetrieveOrganizationsResponse)service.Execute(orgsRequest);
}
DiscoveryServiceProxy类有重载,但如果您提供更多关于您尝试连接到的内容的详细信息,我认为这将缩小它的范围。这是一个内部部署。我在SDK中尝试了这段代码,效果很好。我现在正在使用SDK示例代码,并试图找到导致错误的确切位置。请求的AccessType和Release参数是我的问题。谢谢