Client is WPF, Server is Hosted in IIS - but still need server config in app.config of client

Client is WPF, Server is Hosted in IIS - but still need server config in app.config of client

Old forum URL: forums.lhotka.net/forums/t/8443.aspx


enzed posted on Monday, February 01, 2010

Something not quite right here.

I have a WPF client which needs to communicate to a remote server hosting the server components.

The host has some items in the web.config.

However when I run the application it tries to obtain values from the app.config of the client.

This is not what anyone wants.

Not sure if the application is setup correctly then. The silverlight version has .Client files. But the examples I have seen for WPF don't have this requirement it would seem.

Is there a missing link? Have I setup the WPF client correctly?

Kind Regards,

Nick

RockfordLhotka replied on Monday, February 01, 2010

This is how .NET works.

Each .NET AppDomain has its own config file.

In the case of an ASP.NET app, this is a web.config file. In the case of an EXE (like a WPF app) it is <programname>.exe.config (which is what VS renames your app.config to when you build). And as you note, Silverlight has its own naming convention.

The point being, your WPF app is running on a separate machine, and thus clearly in a separate AppDomain, from the WCF server. So it absolutely needs its own config file.

Copyright (c) Marimer LLC