使用 https 以编程方式提供服务终结点始终获取 404



我正在尝试取回现在通过HTTPS工作的服务,但现在我所有以编程方式访问它的配置都不起作用。我尝试使用

            var firstBinding = new System.ServiceModel.BasicHttpBinding
            {
                Security = new BasicHttpSecurity { Mode = BasicHttpSecurityMode.Transport },
                ReceiveTimeout = new TimeSpan(0, 2, 0)
            };
            var secondBind = new System.ServiceModel.BasicHttpsBinding
            {
                Security = new BasicHttpsSecurity { Mode = BasicHttpsSecurityMode.Transport},
                ReceiveTimeout = new TimeSpan(0, 2, 0),
                MaxBufferSize = 64000000,
                MaxReceivedMessageSize = 64000000,

            };

        var endpoint = new EndpointAddress("https://external-service.com/Service.svc");

我尝试通过以下方式访问:

var client = new ExternalClient.ServiceClient(firstBinding, cacheEndpoint);

 var client = new ExternalClient.ServiceClient(secondBind , cacheEndpoint);

当 y 尝试访问服务时:

var response = client.GetUsersList();

总是得到相同的错误

{"There was no endpoint listening at https://external-service.com/Service.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."}

内部异常:

{"The remote server returned an error: (404) Not Found."}

我在这里错过了什么?

问题已解决。您始终通过端点的 http 和 https 检查访问权限。也在 web.config 上可用的服务配置中。

最新更新