I created a Rest web API and now I want to call the operations exposed by the API from a Proxy. My environment is Visual Studio, C#.
As the operations that I exposed in the API share a part of the URL/endpoint (“_api/NameOfTheController_app.config
How should I use the ConfigurationManager class to call the value of the custom tag?
What I have tried:
In the app.config of the proxy I wrote thee following tag, inside the <client> tag:
`<customEndpointSegment name = “/api/NameOfTheController” />
`
Inside the same <client> tag there is a <endpoint> tag which points to another different service too.
In the Proxy.cs I have the following:
“`
string webApiEndpoint;
HttpClient client;
public RestProxy()
{
webApiEndpoint = ConfigurationManager. // I have to call the value of the tag here
client = new HttpClient();
client.BaseAddress = webApiEndpoint;
}