Where do I set the Multiple Client ConnectionString?

I will develop a utility for a company with over 1000 clients, and the program should win the application with .Net because my program will act with another program. What do you suggest for the app.config site? one scenario: We put app.config on a server that we configured once and started a windows service for it that publishes the connectionString over TCP / IP Socket.

In Socket programming, we don't need anything because we just use the free port to send ConnectioString from server to clients. My scenario is based on this approach. (The default port is built into the app).

+2


source to share


6 answers


Reading your question (I'm transcribing a bit). I can see that clients can be separated from each other and even if it's only on the local network, the following solution will work:

Design a WebService whose only job is to provide a ConnectionString when called.



This allows you to have a "simple" and reliable way to do this and only implement it on your local intranet for security.

Regardless, make sure you encrypt the data and maybe even RSA sign it as a good measure. This will give you a safe, reliable and less time consuming solution to your problem.

+2


source


The app.config app belongs to the client app - I wouldn't even try to hack anything else. Download it as part of your app and install it. In particular, connection strings cannot be outsourced anywhere else.

We are using a hybrid scenario where we only have a connection string in app.config on each client and everything that needs to be configured is in the database table that everyone reads.

But the connection string can't really be centralized in the database ..... how would you connect to the database to read the connection string? :-) Classic chicken and egg problem.



So: just use app.config and put your connection string there (encrypt the section if needed <connectionStrings>

).

The only viable alternative would be to embed the connection string in the application itself - as a constant string in the Constants.cs file or something.

Mark

+1


source


The ideal architecture would be to provide a service that acts as your data tier - your WinForms application will make calls to that service to do all of its interaction with the database. This not only provides an abstraction layer for your data access, but it also centralizes your data connection in one realm (your data service), so you can safely store your connection string on the server that hosts that data service.

+1


source


If you want a central configuration, I would include it in Active Directory under CN = Services, CN = Configuration node.

0


source


I am using a responsive connection string that is configured based on the network and / or machine the application is running on. I wrote a blog post about this approach . The key is to override the SettingsLoaded event to reconfigure the baked connection strings. This will work on any .NET Windows client application or DLL. I even used this technique in a DLL to manage the connection string for web applications. It really makes deployment easier!

Of course, this is not the best approach for all scenarios. One of the downsides is that users and administrators cannot change the connection string with the config file.

0


source


On your server you will have IIS, you can define the url http://myapp.myserver.com , and you can put an xml page in there where clients can be, when they start, they can request http: // myapp. myserver.com/myapp-config.xml and in this file you can store version, connection string, etc.

And you will have to manually create all the variables you are going to load from that xml instead of app.config, but it is not difficult to store the connection string in your program in a static variable started after reading myapp-config.xml

Uploading the app.config in place of the client is not good because if you need to change any values, change the server or balance the load, it will be difficult to reallocate everything.

Instead, you can also keep track of the xml version, if the version is changed, you can notify you to download the new version from the same server and update your program.

0


source







All Articles