Web-Based Configuration Interface for Console Applications
I've been using app.Config and INI files to configure my applications but I wanted to make it more user-friendly. I've already encountered some applications ( most of them are java based ) that its configurations are via web interface ( I think the application is hosting jsp ). How can I do this on .net platform 开发者_如何学Pythonfast and easy?
Thanks for the inputs guys! I'll be implementing my own web server for this to resolve my problem. Sample web server
You can create your configuration files however you like. Transmission uses JSON for it's config, while apps like Active Home Pro use XML.
Writing out your config and consuming the data is totally up to you. If you use ASP.NET MVC, you can spit out JSON data with ease, and XML is almost as easy. The question is how is the user getting the config after they have gone through the GUI?
- do they download a text file?
- Does the browser app run locally and configure the text file in place?
also note: by text file i mean any config file (xml, txt, csv, json, etc)
EDIT
What about building a Windows Forms application for the configuration. It can be a single window (like a single web page would be) and it does all the config on the local machine. Then the console app reads the config without the user knowing any different. All the user has to do is open the config editor.
MyApp.exe
AppConfigurator.exe
EDIT 2
I'm not entirely sure if this is an option, but Microsoft has also just recently released IIS7 Express (a standalone version of IIS), but unfortunately I'm not sure if this is to be used in any type of production or if it's only to be used for development.
EDIT 3
Here is a link to How you can Host an ASP.NET Website Outside of IIS.
There is no way to do this "fast and easy", as far as I know. You're simply going to have to write a web-based interface to your configuration.
Sections in configuration files can be read as objects, which you could data bind to controls on a web form. If it's your own configuration, then you can know ahead of time what it looks like, and what form to use.
精彩评论