简体   繁体   English

Dynamics 365:为什么 .net6 控制台客户端出现“Xrm.Sdk WSDL”错误?

[英]Dynamics 365: why I get "Xrm.Sdk WSDL" error for .net6 console client?

Mac OS, .Net6, C# 10.0. Mac 操作系统、.Net6、C# 10.0。

I always created console clients for MS Dynamics 365 on .Net Framework Platform without problems.我总是在 .Net Framework Platform 上为 MS Dynamics 365 创建控制台客户端,没有任何问题。 But now I need to do the same on .Net Core or newer platform (because I need to put it into Docker container later).但现在我需要在 .Net Core 或更新的平台上做同样的事情(因为我需要稍后将它放入 Docker 容器中)。 At this case I try to use .Net6.在这种情况下,我尝试使用 .Net6。

I created new console application and added the NuGet packages:我创建了新的控制台应用程序并添加了 NuGet 包:

  • Microsoft.PowerPlatform.Dataverse.Client v0.6.6 Microsoft.PowerPlatform.Dataverse.Client v0.6.6
  • System.Configuration.ConfigurationManager v6.0.0 System.Configuration.ConfigurationManager v6.0.0
  • System.ServiceModel.Primitives v4.9.0 System.ServiceModel.Primitives v4.9.0

My simple Program.cs file:我的简单Program.cs文件:

using System.Net;
using System.ServiceModel.Description;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Client;

namespace ConsoleAppExample
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.Title = "CRM console client";

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            var orgServiceUrl = "http://dev-crm-app02/MyCompany/XRMServices/2011/Organization.svc";
            var crmUserLogin = "myLogin";
            var crmUserPassword = "myPassword"; 

            var credentials = new ClientCredentials();
            credentials.UserName.UserName = crmUserLogin;
            credentials.UserName.Password = crmUserPassword;

            try
            {
                using (var orgService = new OrganizationServiceProxy(new Uri(orgServiceUrl),
                           null, credentials, null))
                {
                    RetrieveVersionRequest versionRequest = new RetrieveVersionRequest();
                    RetrieveVersionResponse versionResponse =
                        (RetrieveVersionResponse) orgService.Execute(versionRequest);

                    WhoAmIRequest whoAmIRequest = new WhoAmIRequest();
                    WhoAmIResponse whoAmIResponse = (WhoAmIResponse) orgService.Execute(whoAmIRequest);

                    Console.WriteLine($"\nOrganizationService: {orgServiceUrl}");
                    Console.WriteLine($"CRM version: {versionResponse.Version}");
                    Console.WriteLine($"User login: {crmUserLogin}");

                    Console.WriteLine($"\nOrganizationId: {whoAmIResponse.OrganizationId}");
                    Console.WriteLine($"BusinessUnitId: {whoAmIResponse.BusinessUnitId}");
                    Console.WriteLine($"UserId: {whoAmIResponse.UserId}");
                }
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex.Message); // Xrm.Sdk WSDL
                if (ex.InnerException != null)
                {
                    Console.WriteLine(ex.InnerException.Message);
                }

                Console.ResetColor();
            }
            Console.WriteLine("\nPress ENTER for exit...");
            Console.ReadLine();
        }
    }
}

But when I run my application I get the error:但是当我运行我的应用程序时,我得到了错误:

Xrm.Sdk WSDL Xrm.Sdk WSDL

Why does it happen and how can I solve it?为什么会发生,我该如何解决?

Organization service client is deprecated and is not supported directly on net core.组织服务客户端已弃用,网络核心不直接支持。

When connecting using the dataverse serviceclient, connection string or serviceclient constructor is the only supported way.使用 dataverse serviceclient 连接时,连接字符串或 serviceclient 构造函数是唯一受支持的方式。

That said onprem is not well supported due to the changes I the underlying authentication stack.也就是说,由于底层身份验证堆栈的更改,onprem 没有得到很好的支持。

Best currently possible supported feature is to use oAuth via adfs on prem with a custom auth handler.当前可能支持的最佳功能是通过 adfs on prem 与自定义身份验证处理程序一起使用 oAuth。

There is an extension written by a user of the dataverse service client that adds AD and WSTrust support for net core, but it is not part of the MS distribution. Dataverse 服务客户端的用户编写了一个扩展,它添加了对网络核心的 AD 和 WSTrust 支持,但它不是 MS 分发的一部分。

You can find a link to it on the dataverse serviceclient GitHub site issues board under the AD onPrem support topic https://github.com/microsoft/PowerPlatform-DataverseServiceClient/issues/110您可以在 AD onPrem 支持主题https://github.com/microsoft/PowerPlatform-DataverseServiceClient/issues/110下的 dataverse serviceclient GitHub 站点问题板上找到指向它的链接

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么在Dynamics 365 XRM工具SDK中使用IOrganizationService而不是CrmServiceClient? - Why use IOrganizationService instead of CrmServiceClient in Dynamics 365 XRM tooling SDK? Xrm.sdk和Sharepoint 2013 - Xrm.sdk and Sharepoint 2013 Xrm.Sdk Linq with Joins and dynamic where - Xrm.Sdk Linq with Joins and dynamic where 如何使用 Dynamics 365 XRM Tooling SDK 通过主 ID 一般获取实体记录的枚举集 - How to generically get enumerated set of entity records by primary id with Dynamics 365 XRM Tooling SDK 访问Dynamics365时发生错误“ Microsoft.Xrm.Sdk.dll中发生System.ServiceModel.Security.MessageSecurityException” - An error “System.ServiceModel.Security.MessageSecurityException' occurred in Microsoft.Xrm.Sdk.dll” occurs when accessing Dynamics365 Microsoft Dynamics 365 SDK Core 程序集 .NET Core 移植错误 - Microsoft Dynamics 365 SDK Core Assemblies .NET Core Porting Error 使用XRM SDK从ms dynamics crm获取相关数据 - get related data from ms dynamics crm using XRM SDK Dynamics CRM xrm.cs编译错误 - Dynamics CRM xrm.cs compile error 尝试将删除记录 function 添加到我的 web 应用程序,该应用程序使用 XRM 工具更新/编辑 Dynamics 365 中的记录并不断收到此错误? - Trying to add a delete record function to my web app that uses XRM tooling to update/edit records in Dynamics 365 and keep getting this error? 客户端为 Dynamics 365 添加了新沙盒,尝试插入数据时出现 401 错误 - Client added new sandbox for Dynamics 365, and when trying to insert data I'm getting a 401 error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM