简体   繁体   English

WCF 服务在 MVC 客户端中有效,但在.Net Core 3 客户端中无效

[英]WCF service works in MVC client but not in .Net Core 3 client

We have an old WCF service that works fine with an existing MVC application.我们有一个旧的 WCF 服务,可以与现有的 MVC 应用程序一起正常工作。

We have recently copied much of the MVC application in to a new.Net Core 3 application.我们最近将大部分 MVC 应用程序复制到了一个新的 .Net Core 3 应用程序中。

Consuming the WCF service however gives the following error with the.Net Core application:但是,使用 WCF 服务会在 .Net Core 应用程序中出现以下错误:

'service.InnerChannel' threw an exception of type 'System.ServiceModel.CommunicationObjectFaultedException' “service.InnerChannel”引发了“System.ServiceModel.CommunicationObjectFaultedException”类型的异常

I am running the service locally and both client applications locally.我在本地运行服务并在本地运行两个客户端应用程序。

Controller Controller

    wcfClient wcfService = getService();

Helper帮手

    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;
    }

Reference to the service:服务参考:

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

I am not familiar with.Net Core but to consume the service I right clicked on Service Connections > Add Service Reference.我不熟悉.Net Core,但为了使用我右键单击服务连接>添加服务引用的服务。

Any help greatly appreciated非常感谢任何帮助

Core's support for WCF is very limited, currently only supports BasicHttpBinding, CustomBinding, NetHttpBinding, NetTcpBinding. Core对WCF的支持非常有限,目前只支持BasicHttpBinding、CustomBinding、NetHttpBinding、NetTcpBinding。 Core's support for WCF security is not particularly good. Core 对 WCF 安全性的支持不是特别好。 Core does not have the security of the Message layer. Core 没有 Message 层的安全性。

在此处输入图像描述

You need to check whether your WCF service uses features that core does not support.您需要检查您的 WCF 服务是否使用了核心不支持的功能。 Please refer to this link for core support for WCF:有关 WCF 的核心支持,请参阅此链接:

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

Feel free to let me know if the problem persists.如果问题仍然存在,请随时告诉我。

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

相关问题 来自 appsetting.json (.NET Core) 的 WCF 服务客户端配置 - WCF service client configuration from appsetting.json (.NET Core) 如何在ASP.Net核心中注入WCF服务客户端? - How to inject WCF service client in ASP.Net core? 与无.Net客户端共享WCF服务中的.Net类型 - Sharing .Net types in a wcf service with a no .Net client .Net Core 2.0调用WCF客户端配置 - .Net Core 2.0 call to WCF client configuration 带有WCF服务的ASP.NET Core MVC - ASP.NET Core MVC with WCF Service 未使用SetAuthCookie和完整的.net客户端维护对WCF服务的身份验证,但可与Silverlight一起使用 - Authentication to a WCF service not maintained using SetAuthCookie and a full .net client but works with silverlight 如何解决 .NET Core 客户端应用程序中的 WS2007HttpBinding WCF 服务绑定 - How Can I resolve WS2007HttpBinding WCF Service Binding in .NET Core Client Application 有没有办法让客户端连接到现有的 WCF Web Http 服务而不使用 WebHttpBinding in.Net Core 2? - Is there any way to have a client connect to an existing WCF Web Http Service without using WebHttpBinding in .Net Core 2? 无法使用Asp.net Core WCF连接的服务添加多个客户端证书 - Cannot add multiple client certificates with asp.net core wcf connected service WCF客户端-连接到服务 - WCF Client - connect to service
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM