以编程方式使用https的服务端点始终获得404

时间:2018-03-20 20:01:13

标签: .net web-services service

我试图找回现在通过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);

当您尝试访问服务时:

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."}

我在这里想念的是什么?

1 个答案:

答案 0 :(得分:0)

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