【问题标题】:Net Core WCF error "One or more errors occurred. (There was no endpoint listening at"Net Core WCF 错误“发生一个或多个错误。(没有端点监听”
【发布时间】:2020-02-25 18:25:40
【问题描述】:

我正在调用外部肥皂服务。在开发中它工作正常,但在服务器上发布它会引发指示的错误。

“发生了一个或多个错误。(在 https://myservice 处没有侦听的端点可以接受该消息。这通常是由不正确的地址或 SOAP 操作引起的。请参阅 InnerException,如果存在,了解更多详细信息。)”

如果我刷新页面,错误会发生变化:

处理请求时发生未处理的异常。 AggregateException:发生一个或多个错误。 (对象是只读的。) System.Threading.Tasks.Task.GetResultCore(bool waitCompletionNotification)

InvalidOperationException:对象是只读的。 System.ServiceModel.Security.X509CertificateRecipientClientCredential.ThrowIfImmutable()

这是代码:

            PortTypeClient.ClientCredentials.ServiceCertificate.SslCertificateAuthentication= new X509ServiceCertificateAuthentication()
            {
                CertificateValidationMode = X509CertificateValidationMode.None,
                RevocationMode = X509RevocationMode.NoCheck
            };

【问题讨论】:

    标签: .net wcf iis soap service


    【解决方案1】:

    根据错误消息"One or more errors occurred. (There was no endpoint listening at that https://myservice could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.)",您似乎没有在服务配置中定义绑定,因此您获得了 wsHttpBinding 的默认值,并且该绑定的 securityMode\transport 的默认值是 Message。

    您应该在应用程序目录中打开“Web.config”并将以下配置代码添加到文件中。在运行时,WCF 基础结构使用这些信息来构建客户端应用程序可以与之通信的端点。

    配置:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.serviceModel>
        <services>
          <service name="Microsoft.ServiceModel.Samples.CalculatorService">
    
            <!-- This endpoint is exposed at the base address provided by host: http://localhost/servicemodelsamples/service.svc -->
            <endpoint address=""
                      binding="wsHttpBinding"
                      contract="Microsoft.ServiceModel.Samples.ICalculator" />
    
            <!-- The mex endpoint is explosed at http://localhost/servicemodelsamples/service.svc/mex -->
            <endpoint address="mex"
                      binding="mexHttpBinding"
                      contract="IMetadataExchange" />
          </service>
        </services>
      </system.serviceModel>
    
    </configuration>
    

    有关如何在 IIS 上托管 wcf 应用程序的更多详细信息,您可以参考此article

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-07-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多