[英]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.6System.Configuration.ConfigurationManager
v6.0.0 System.Configuration.ConfigurationManager
v6.0.0System.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.