简体   繁体   English

没有端点侦听 ... 可以接受消息

[英]There was no endpoint listening at ... that could accept the message

I'm building an ASP.NET Core web API project.我正在构建一个 ASP.NET Core Web API 项目。

Service runs sometimes, sometimes fails.服务有时运行,有时失败。

I get 90% successful results.我得到了 90% 的成功结果。

There was no endpoint listening at (url) that could accept the message.没有端点侦听 (url) 可以接受消息。 This is often caused by an incorrect address or SOAP action.这通常是由不正确的地址或 SOAP 操作引起的。 See InnerException, if present, for more details.有关更多详细信息,请参阅 InnerException(如果存在)。

The binding is as follows绑定如下

在此处输入图片说明

The service should work improperly.该服务应该无法正常工作。 By default, the invocation sent by a proxy preferentially uses the service URI generated in the reference.cs file.默认情况下,代理发送的调用优先使用reference.cs 文件中生成的服务URI。
在此处输入图片说明
We should change it to the practical service URL.我们应该将其更改为实用的服务 URL。

https://vabqia96vm:21011/ https://vabqia96vm:21011/

Furthermore, the service communicates with the client is protected by the transport layer security.此外,服务与客户端的通信受到传输层安全性的保护。 We should trust the server's certificate before sending an invocation or add a procedure of SSL authentication to ignore validating the server's certificate.我们应该在发送调用之前信任服务器的证书,或者添加 SSL 身份验证程序以忽略验证服务器的证书。

ServiceReference1.ServiceClient client = new ServiceClient();
//ignore the SSL authentication.            
client.ClientCredentials.ServiceCertificate.SslCertificateAuthentication=new System.ServiceModel.Security.X509ServiceCertificateAuthentication()
            {
                CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None,
                RevocationMode = System.Security.Cryptography.X509Certificates.X509RevocationMode.NoCheck
            };
            var result = client.TestAsync();
            Console.WriteLine(result.Result);

Also, we could call the service by using ChannelFactory.此外,我们可以使用 ChannelFactory 调用该服务。

class Program
{
    static void Main(string[] args)
    {
        Uri uri = new Uri("https://vabqia969vm:21011");
        BasicHttpsBinding binding = new BasicHttpsBinding();
        binding.Security.Mode = BasicHttpsSecurityMode.Transport;
        binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
        ChannelFactory<IService> factory = new ChannelFactory<IService>(binding, new EndpointAddress(uri));
        factory.Credentials.ServiceCertificate.SslCertificateAuthentication=new System.ServiceModel.Security.X509ServiceCertificateAuthentication()
        {
            CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None,
            RevocationMode = System.Security.Cryptography.X509Certificates.X509RevocationMode.NoCheck
        };
        var client = factory.CreateChannel();
        var result = client.Test();
        Console.WriteLine(result);
    }


}
//the service contract is shared between the server-side and the client-side.
[ServiceContract]
public interface IService
{
    [OperationContract]
    string Test();
}

Feel free to let me know if there is anything I can help with.如果有什么我可以帮忙的,请随时告诉我。

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

相关问题 WCF:没有端点在侦听,可以接受消息 - WCF: There was no endpoint listening at, that could accept the message 没有端点监听 <url> 可以接受消息 - There was no endpoint listening at <url> that could accept the message 在[url]没有可以接受该消息的端点 - There was no endpoint listening at [url] that could accept the message 没有端点监听 <urlToMex> 可以接受消息 - There was no endpoint listening at <urlToMex> that could accept the message 没有端点可以在“ https://…”上收听该消息 - There was no endpoint listening at “https://…” that could accept the message 在net.tcp:// localhost:10001上没有侦听端点可以接受该消息 - There was no endpoint listening at net.tcp://localhost:10001 that could accept the message 没有在WcfPortal.svc上侦听的终结点可以接受该消息 - There was no endpoint listening at WcfPortal.svc that could accept the message ASP核心“没有在[url]上侦听的终结点可以接受该消息。 ” - ASP Core “There was no endpoint listening at [url] that could accept the message. ” 使用WCF Web服务时“没有侦听端点可以接受消息” - “There was no endpoint listening at that could accept the message” when consuming WCF web service WP7 + WCF 服务:在(URL)处没有可以接受消息的端点监听 - WP7 + WCF Service: There was no endpoint listening at (URL) that could accept the message
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM