I am new to WCF and I have some difficulties understanding certain things…
I want to create a web service, so I have created a WCF application service that I will be able to host via my IIS server, so far so good, right ?
But that service need some settings, like the SQL Server address where he have to get his data. And that’s where I don’t understand how I am supposed to create a WPF application that will control the service.
I know how to create a client application to consume the service, but how to create a WPF application that will be installed on the server, and when launched will retrieve the service and allow me to tell him parameters I want him to use.
If someone could give me the overall workflow, it will be greatly appreciate ^^
Usually, there’s a configuration file that goes with the web service (like the app.config file for applications). The file is called
web.config. This is the place where you configure everything – from the service behavior to specific settings like connection strings etc.Usually you do not have a configuration tool for a web service – you edit the
web.configfile and you’re done.EDIT
OK, if you really want such a program, there are ways to do that. I’d try the following:
The
web.configfile contains a section calledappSettingsfor application settings. This section can be outsourced into a separate file. The line to include such a file would look like:The file itself would contain a normal
appSettingssection:Now you could have a normal application that reads the XML file
mysettings.configand is able to write a changed version of the file (please note that you need appropriate rights to read/write the file).While you shouldn’t need to restart IIS or the WebService upon changes to the
web.configfile, I’m not sure about changes to themysettings.configfile – you might need to restart your WebService after modifying the file.Another way would be to create functions in the service that allows a client to get/change settings and the service itself stores them somewhere.