WCF 服务适用于 MVC 客户端,但不适用于 .Net Core 3 客户端 [英] WCF service works in MVC client but not in .Net Core 3 client

查看:37
本文介绍了WCF 服务适用于 MVC 客户端,但不适用于 .Net Core 3 客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个旧的 WCF 服务,可以很好地与现有的 MVC 应用程序配合使用.

We have an old WCF service that works fine with an existing MVC application.

我们最近将大部分 MVC 应用程序复制到新的 .Net Core 3 应用程序中.

We have recently copied much of the MVC application in to a new .Net Core 3 application.

然而,使用 WCF 服务会导致 .Net Core 应用程序出现以下错误:

Consuming the WCF service however gives the following error with the .Net Core application:

'service.InnerChannel' 引发了类型为 'System.ServiceModel.CommunicationObjectFaultedException' 的异常

'service.InnerChannel' threw an exception of type 'System.ServiceModel.CommunicationObjectFaultedException'

我在本地运行服务,并在本地运行两个客户端应用程序.

I am running the service locally and both client applications locally.

控制器

    wcfClient wcfService = getService();

帮手

    public wcfClient getService()
    {
        wcfClient service = new wcfClient ();

        string userName = AppSettings.wcfServicesClientUsername;
        string password = AppSettings.wcfServicesClientPassword;
        string passPhrase = AppSettings.wcfServicesClientPassPhrase;

        userName = ServiceHelper.Encrypt(userName, passPhrase);
        password = ServiceHelper.Encrypt(password, passPhrase);

        return service;
    }

对服务的引用:

    public wcfClient() : 
            base(wcfClient.GetDefaultBinding(), wcfClient.GetDefaultEndpointAddress())
    {
        this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_IwcfClient.ToString();
        ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
    }

我不熟悉 .Net Core,但为了使用我右键单击服务连接的服务 >添加服务引用.

I am not familiar with .Net Core but to consume the service I right clicked on Service Connections > Add Service Reference.

非常感谢任何帮助

推荐答案

Core 对 WCF 的支持非常有限,目前只支持 BasicHttpBinding、CustomBinding、NetHttpBinding、NetTcpBinding.Core 对 WCF 安全性的支持不是特别好.Core不具备Message层的安全性.

Core's support for WCF is very limited, currently only supports BasicHttpBinding, CustomBinding, NetHttpBinding, NetTcpBinding. Core's support for WCF security is not particularly good. Core does not have the security of the Message layer.

您需要检查您的 WCF 服务是否使用了核心不支持的功能.有关 WCF 的核心支持,请参阅此链接:

You need to check whether your WCF service uses features that core does not support. Please refer to this link for core support for WCF:

https://github.com/dotnet/wcf/tree/master/release-notes

如果问题仍然存在,请随时告诉我.

Feel free to let me know if the problem persists.

这篇关于WCF 服务适用于 MVC 客户端,但不适用于 .Net Core 3 客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆