wcf - Trouble connecting to API -


i new wcf/apis , know little nothing security. let me know if need provide more information.

i trying connect service using

<system.servicemodel>     <bindings>         <basichttpbinding>             <binding name="basichttpbinding_isalesorderservice">                <security mode="transport" >                   <transport clientcredentialtype="basic"></transport>                </security>             </binding>             <binding name="basichttpbinding_idocumentationservice">                <security mode="transportcredentialonly" >                   <transport clientcredentialtype="basic"></transport>                </security>             </binding>         </basichttpbinding>     </bindings>     <client>         <endpoint address="address1"             name="basichttpbinding_isalesorderservice"              binding="basichttpbinding"             bindingconfiguration="basichttpbinding_isalesorderservice"             contract="socalls.isalesorderservice" />         <endpoint address="address2"             binding="basichttpbinding"              bindingconfiguration="basichttpbinding_idocumentationservice"             contract="doccalls.idocumentationservice"              name="basichttpbinding_idocumentationservice" />     </client> </system.servicemodel> 

with this, error:

'system.servicemodel.security.messagesecurityexception'  http request unauthorized client authentication scheme 'basic'.  authentication header received server 'basic realm'. 

edit followed instructions suggested in link provided in comments, still giving me error. updated code think still bit confused on whether use http/https due lack of knowledge of either service.

here how instantiate service:

private static socalls.salesorderserviceclient createsalesorderserviceclient()     {         basichttpbinding mybinding = new basichttpbinding();         mybinding.maxreceivedmessagesize = 10000 * 2;         mybinding.security.mode = basichttpsecuritymode.transportcredentialonly;         mybinding.security.transport.clientcredentialtype = httpclientcredentialtype.basic;         endpointaddress ea = new endpointaddress("address1");         socalls.salesorderserviceclient client = new socalls.salesorderserviceclient();         client.clientcredentials.username.username = ("username");         client.clientcredentials.username.password = ("password");                     return client;     } 

as seems, did not have access api specific database giving me error. tried sending other credentials separate database same server , worked fine. purchased license required , code works expected.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -