Karnalta
Karnalta

Reputation: 538

WCF service managed by a WPF application?

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 ^^

Upvotes: 0

Views: 730

Answers (1)

Thorsten Dittmar
Thorsten Dittmar

Reputation: 56727

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.config file 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.config file contains a section called appSettings for application settings. This section can be outsourced into a separate file. The line to include such a file would look like:

<appSettings file="mysettings.config"/>

The file itself would contain a normal appSettings section:

<appSettings>
    <add key="Info" value="myself" />
</appSettings>

Now you could have a normal application that reads the XML file mysettings.config and 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.config file, I'm not sure about changes to the mysettings.config file - 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.

Upvotes: 1

Related Questions