renu
renu

Reputation: 51

How to make a call to secured web service(HTTPS) using basic http binding?

I need to import some model file into a Sharepoint central admin(HTTPS) from my local machine. What should be the configuration(using service.model)? I am using the following configuration...
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_BusinessDataCatalogSharedService" contract="BusinessDataCatalogSharedService" name="BasicHttpBinding_BusinessDataCatalogSharedService" />

And i am using the following c# code... BusinessDataCatalogSharedServiceClient client = new BusinessDataCatalogSharedServiceClient("BasicHttpBinding_BusinessDataCatalogSharedService1"); client.ClientCredentials.UserName.UserName = "..."; client.ClientCredentials.UserName.Password = "....";

I am getting the following error

MessageSecurityException was unhandeled The HTTP request was forbidden with client authentication scheme 'Basic'.

I dont have enough knowledge about the authentication...Please help me out.

Thanks

Upvotes: 1

Views: 3673

Answers (2)

Rory Primrose
Rory Primrose

Reputation: 633

Most likely the problem is that you are running the service over HTTP not HTTPS. This will not work with username/password authentication. WCF is secure by default such that it will disallow calls with this type of authentication over HTTP.

You need to configure your service with a certificate to run over HTTPS and then also make the appropriate changes to you config (as is described in the link renu has posted).

Upvotes: 0

Aravind
Aravind

Reputation: 4163

Take a look at this information http://blog.adnanmasood.com/2008/07/16/https-with-basichttpbinding-note-to-self/

Upvotes: 0

Related Questions