2
I am working on a Web Forms project that has a DLL, and in this DLL there are references to external services. We have 3 environments (development, homologation and production) and for each environment there is a specific URL for each of the services, in its version for the respective environment.
I am having problems managing the Urls of these services. In the Webforms project I have the web.config
where I can use XML Transformations to store key/value sets, and this would solve my problem. However, in DLL I only have one file app.config
and the same does not support Transformations. What is the most appropriate way to get my solution adapted to integrate with the correct environment, based only on the Configuration used during the Publish process?
Just to highlight my current template: I create a web.Config entry with the service URL
<add key="UrlServicoCep" value="http://url_dev/servico.asmx" />
Then I recover this value and the step as a parameter in the instantiation of the class in which the service is used:
string urlServico = ConfigurationManager.AppSettings["UrlServicoCep"];
var dao = new CepDAO(urlServico);
Summary: I want to generate a package for the desired environment (homologation or production) and that this generation of the package already has the correct URL applied to the web services that consumption.
But taking into account the native limitation of not having xml Transformation, how would you solve the problem?
– Tiago César Oliveira
@Tiagocésaroliveira Without considering the extension, I believe your mode is already suitable, with some options for security. I will edit the answer.
– Leonel Sanches da Silva