0
Hello, I created an application in C# and for access to the database I did the following procedure: In the app.config file I created the following:
<add name="MyDatabase"
connectionString="server=192.168.10.100;user id=usuario;password=senha;database=nomeDataBase";providerName="MySql.Data.MySqlClient"/>
After that, in my code I called the connections like this:
var constring=ConfigurationManager.ConnectionStrings["Mydatabase"].ConnectionString;
So far so good, on the machine I developed this works perfectly, however, if I take it to another host and try to change the mysql server (linux - 192.168.10.100) by another network (linux also - 192.168.10.110) it does not connect, even changing the information of App.config. It’s like he still has the data from the test server. How can I change these values since I will have for example to use more than one server in different cases and keep compiling and publishing the project is sometimes an unnecessary job.
Provide more details, is it a web application, a service or what? You restarted the application process or pool after changing the
app.config
?– Leandro Angelo
It is a desktop application using windows Forms, about changing the application data I did not get to restart the service. Just went in the directory generated by VS, there is a directory called Application Files, a file of type . Application and a setup. Inside the Application directory I modified the file "Filename.exe.config.deploy", in it I inserted the mysql server information.
– banana
Using
Transformation
is the easiest way, really.– Zorkind
Modifying the installation package after generated is not a good idea @banana
– Zorkind
A hint, leaves a TEXT field where you type the address and it connects in this address typed, then you can change without modifying the file.
– PauloHDSousa