Question

I am currently converting Webservice(ASMX) project to WCF(SVC) project, and I am having trouble with the following.

WebClientProtocol.UseDefaultCredentials = false

For example, This is my current code for Webservice

var client = new MyService.MyService();
client.UseDefaultCredentials = true;

I would like to change for WCF

var client = new MyService.MyService();
// Your answer

Your help would be appreciated :)

Was it helpful?

Solution

Authentication settings are much more complex in WCF. If you create a service reference, the app/web configuration file is set up to reflect the current requirements of the service. So you can just ignore setting credentials in your code. Have you tried to run it and does it work? If it works, then you're done, if it doesn't, then please tell us what kind of authentication the service needs and whose credentials you would like to use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top