【问题标题】:WCF service works in MVC client but not in .Net Core 3 clientWCF 服务适用于 MVC 客户端,但不适用于 .Net Core 3 客户端
【发布时间】:2020-08-07 12:23:48
【问题描述】:

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

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

但是,使用 WCF 服务会在 .Net Core 应用程序中出现以下错误:

“service.InnerChannel”引发了“System.ServiceModel.CommunicationObjectFaultedException”类型的异常

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

控制器

    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,但为了使用服务,我右键单击服务连接 > 添加服务引用。

非常感谢任何帮助

【问题讨论】:

  • 您好,问题解决了吗?如果问题仍然存在,请随时告诉我。

标签: c# wcf asp.net-core


【解决方案1】:

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

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

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

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

【讨论】:

    猜你喜欢
    • 2020-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-01
    • 1970-01-01
    相关资源
    最近更新 更多