Wcf 更改端点配置上的ip地址

Wcf 更改端点配置上的ip地址,wcf,Wcf,我导入了一个wsdl,并设置了我的web服务。 这非常有效,但现在我希望我使用的IP地址具有一定的灵活性 根据链接,这似乎很简单 我所要做的就是将endpoint属性设置为我想要的: var client = new SampleClient(); client.Endpoint.Address = new EndpointAddress(url); client.Open(); responseMessage = client.ServiceMethod(requestMessage);

我导入了一个wsdl,并设置了我的web服务。 这非常有效,但现在我希望我使用的IP地址具有一定的灵活性

根据链接,这似乎很简单

我所要做的就是将endpoint属性设置为我想要的:

var client = new SampleClient();
client.Endpoint.Address = new EndpointAddress(url);
client.Open();
responseMessage = client.ServiceMethod(requestMessage);
但在我的具体示例中,我没有可以命中的“端点”属性。 我错过了什么

PersonSearchWebServiceClient wc = new PersonSearchWebServiceClient();
PersonSearchResult r = wc.FindByPersonDetails(ps);

我的wc对象没有EndPoint属性

将在web/app.config中为导入的服务的URL设置,请更新此设置。

我的项目中的工作代码(连接到Alfresco web服务)


您的意思是,您没有在PersonSearchWebServiceClient类上看到Endpoint proerty?正确。我只是没有它,所以我猜,它是有效的。对吗?很好用。只是没有端点字段PersonSearchWebServiceClient是否从ClientBase继承?这将起作用。但这并不理想,因为我在配置中覆盖了所有基本的HttpBinding规则
private AuthenticationServiceSoapPortClient getAuthService()
    {
        if (_authClient == null || _authClient.State != CommunicationState.Opened)
        {
            BasicHttpBinding basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport); // For no-Ssl use None
            basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
            basicHttpBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
            basicHttpBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
            basicHttpBinding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.Default;
            var endPoint = new EndpointAddress(_alfrescoURL + "/" + _authEndPointPart);
            _authClient = new AuthenticationServiceSoapPortClient(basicHttpBinding, endPoint);
        }
        return _authClient;
    }