简体   繁体   中英

WCF basicHttpBinding Setting Credential hosted in Windows service

Where I can setup the Username and password for me service which are using basicHttpBinding

<binding name="proxioBasicHttpBinding"
                 closeTimeout="05:00:00" 
                 openTimeout="05:00:00"
                 receiveTimeout="05:00:00" 
                 maxBufferSize="2147483647" 
                 maxReceivedMessageSize="2147483647"
                 messageEncoding="Mtom" 
                 transferMode="Streamed" >
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Digest" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>

If the service is hosted under windows service ?

are you trying to pass the windows credentials to your service ? or provide it for the response ? i am not 100% clear on what you are trying to accomplish.

If i understand what you are doing you cant do it through the config. You do it in code like this

client.ClientCredentials.UserName.UserName = UserId;
client.ClientCredentials.UserName.Password = Password;

But if you are trying to configure windows credentials in the config file. First off its not recommended but here is a couple of links for that.

How to specify Windows credentials in WCF client configuration file

http://msdn.microsoft.com/en-us/library/ms733131.aspx

And this describes security for multiple scenarios.

http://msdn.microsoft.com/en-us/library/ff405740.aspx

Another helpful link on wcf security http://wcfsecurityguide.codeplex.com/releases/view/15892

I think you will get a lot more responses if you describe your situation and clarify what it is you need accomplished.

But if this helps by all means award me the rep :)

Why configure the user id and password in the config file? It would be more secure to change the user under which your service runs. This can be done by right-clicking your service, selecting Properties, and setting up the account on the Log on tab.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM