0

I am trying to get the endpointURL. To get those endpointURL, I have to use system.servicemodel.configuration nuget package. However, in .net CORE I am not able to find those package. I am getting error in the below code

    public static string GetEndPointUrl(string contractName)
    {
        var address = string.Empty;

        var serviceModel = (ClientSection)ConfigurationManager.GetSection("system.serviceModel/client");
        var endPoint = serviceModel.Endpoints.Cast<ChannelEndpointElement>().SingleOrDefault(x => x.Contract == contractName);
        if (endPoint != null)
            address = endPoint.Address.AbsoluteUri.ToString();
        return address;
       
    }

I am getting error in clientSection and ChannelEndpointElement which is the part of system.servicemodel. I dont know what is the alternative of this.

  • Core's support for WCF is not good. Many WCF libraries cannot be used in the core. Currently, the WCF library supported in .Net core is relatively limited. You can refer to the following link. This link details the support of .Net core for WCF:https://github.com/dotnet/wcf – Ding Peng Jul 01 '20 at 06:56

0 Answers0