【问题标题】:CRM 2011 Dicovery Service FaultExceptionCRM 2011 发现服务故障异常
【发布时间】:2011-06-15 23:11:21
【问题描述】:

我在http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/d5d00302-8f7b-4efc-873b-c54b3e29749d 提出了同样的问题,但没有得到答案。所以,我会在stackoverflow上再试一次。

我正在运行 crm 2011 培训工具包中的示例代码。

 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 应该是正确的。这是身份验证问题吗?

【问题讨论】:

    标签: crm dynamics-crm-2011


    【解决方案1】:

    这是针对 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 示例代码并尝试找到导致错误的确切位置。
    • Request 的 AccessType 和 Release 参数对我来说是个问题。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-26
    • 2013-11-29
    • 1970-01-01
    • 2020-11-02
    • 2011-04-07
    • 1970-01-01
    相关资源
    最近更新 更多