简体   繁体   English

WCF 客户端迁移到 .NET 6

[英]WCF client migration to .NET 6

I am trying to migrate my WCF client from .NET Framework to .NET 6 using the CoreWCF package.我正在尝试将我的 WCF 客户端从 .NET 框架迁移到 .NET 6 使用 CoreWCF ZEFE90A8E604A7C840E88D03A676B。

I have this binding configuration in old project:我在旧项目中有这个绑定配置:

<binding name="CustomBinding_IService">
    <security 
        defaultAlgorithmSuite="Basic128" 
        authenticationMode="Kerberos" 
        requireDerivedKeys="true" 
        includeTimestamp="true" 
        messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" 
        requireSignatureConfirmation="false">
        <localClientSettings detectReplays="true"/>
        <localServiceSettings detectReplays="true"/>
    </security>
    <binaryMessageEncoding/>
    <httpTransport 
         maxReceivedMessageSize="2147483647" 
         maxBufferSize="2147483647" 
         maxBufferPoolSize="2147483647"/>
</binding>

And this endpoint configuration:而这个端点配置:

<endpoint 
    address="https://my-address/Service.svc" 
    binding="customBinding" 
    bindingConfiguration="CustomBinding_IService" 
    contract="TestClient.IService" 
    name="CustomBinding_IService">
    <identity>
        <servicePrincipalName value="host/test"/>
    </identity>
</endpoint>

When I tried to specify this SPN I got an error that it is not supported.当我尝试指定此 SPN 时,我收到一个错误,即它不受支持。 Is it possible to to implement such a client configuration in .NET 6 at all?是否有可能在 .NET 6 中实现这样的客户端配置?

For client configuration, try usingCoreWCF .对于客户端配置,请尝试使用CoreWCF

As of April 2022, CoreWCF has been supported by Microsoft, but it is not fully functional, only supports some features of WCF and requires code modification in the original.NET framework to be tested successfully.截至 2022 年 4 月,CoreWCF 已获得微软支持,但功能不全,仅支持 WCF 的部分功能,需要在原 .NET 框架中修改代码才能测试成功。

As an alternative to WCF, I think you could consider gRPC.作为 WCF 的替代方案,我认为您可以考虑使用 gRPC。

WCF on .NET 6 requires different NuGet-packages for the client and the service. .NET 6 上的 WCF 需要客户端和服务的不同 NuGet 包。

However, as far as I know, the client cannot use the config-file to define the endpoint.但是,据我所知,客户端不能使用配置文件来定义端点。 (The service does, with the CoreWCF.ConfigurationManager package). (该服务使用 CoreWCF.ConfigurationManager 包)。 So the CoreWCF client has to be defined in C# code.因此必须在 C# 代码中定义 CoreWCF 客户端。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM