Tobias
Tobias

Reputation: 2139

WCF basicHttpBinding with username & password in config file

I have an existing WCF service, written in C#, which is hosted in an own process (not in IIS). Now I want to re-configure this service, so that the following requirements are met:

  1. It has to use basicHttpBinding
  2. It has to use SSL
  3. No code changes, just changes in the service's and client's .exe.config file
  4. Username and password authentication; as there is only one known client, a single hard-coded username/password would be sufficient

I have already searched pretty much but it seems that 4. and 3. are not possible in this combination. The ideal thing would be if one could just hard-code a username and password in the service's .exe.config file. Is this possible at all?

If yes, how would such a config file look like?

If no, what would be feasible alternatives, meeting requirements 1.-3. and what would their config file look like?

Upvotes: 1

Views: 2396

Answers (1)

Louie Bacaj
Louie Bacaj

Reputation: 1417

To get 1 through 3 try the following (Really no code changes just configuration and setup):

SSL with Self-hosted WCF Service

However 4, I think, will be impossible without code changes you will need to provide that user name/password to the service somehow and then on the service do a check for it. Configuration wont save you there, need to roll up your sleeves and put down some C# .NET!

Upvotes: 1

Related Questions