WCF Webservice UserCredentials

时间:2013-08-19 10:59:41

标签: c# asp.net wcf

我想将我使用的Web服务的UserCredentials添加到我网站的web.config文件中。

e.g:

<system.serviceModel>
    <bindings>             
           <customBinding>                                  
             <binding bindingConfiguration="myBinding"  
               <security enableUnsecuredResponse="true" authenticationMode="UserNameOverTransport" securityHeaderLayout="Lax" />
               <textMessageEncoding messageVersion="Soap11" />
               <httpsTransport />
             </binding>                           
           </customBinding>
    </bindings>
    <client>
      <endpoint address="https://www.mycompany.com/foo.ashx"  binding="customBinding" bindingConfiguration="myBinding" username="123" password="123"  contract="foo.bar" name="foosoap" />
    </client>
</system.serviceModel>

username =“123”password =“123”

而不是

ws.SomethingServiceClient svc = new ws.SomethingServiceClient();
svc.ClientCredentials.UserName.UserName = 123;
svc.ClientCredentials.UserName.Password = 123;

0 个答案:

没有答案