CRM 2011 发现服务故障异常

发布于 2024-11-15 10:05:25 字数 1977 浏览 3 评论 0原文

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

I have asked the same question at http://social.microsoft.com/Forums/en-US/crmdevelopment/thread/d5d00302-8f7b-4efc-873b-c54b3e29749d but didn't get an answer. So, I will give another try at stackoverflow.

I was running the example code from the crm 2011 training kit.

 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;

At the line of var response = dsp.Execute(orgRequest), I got the FaltException`1, the detailed message is as follows

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)

I was able to access the Discovery.svc file using browser. So the server url should be correct. Is this an authentication problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

但可醉心 2024-11-22 10:05:25

这是针对 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 类有重载,但如果您提供有关您尝试连接的内容的更多详细信息,我认为它会缩小范围它下来。

Is this for Microsoft CRM Online or on-premise? For Online, I know you would want to use something along the lines of what is found in the 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);
}

There are overloads for the DiscoveryServiceProxy class but if you provide some more details on what you are trying to connect to, I think it will narrow it down.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文