WCF basicHttpBinding设置Windows服务中托管的凭据

本文关键字:basicHttpBinding 设置 Windows 服务 WCF | 更新日期: 2023-09-27 18:14:37

我可以为我的服务设置用户名和密码,使用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>

如果服务托管在windows服务下?

WCF basicHttpBinding设置Windows服务中托管的凭据

您正在尝试将Windows凭据传递给您的服务吗?或者为响应提供它?我不是百分之百清楚你想要完成什么。

如果我明白你在做什么,你不能通过配置来做。你可以用这样的代码

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

但是如果您试图在配置文件中配置windows凭据。首先,这是不推荐的,但这里有几个链接。

如何在WCF客户端配置文件中指定Windows凭证

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

这描述了多个场景的安全性。

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

另一个关于wcf安全性的有用链接http://wcfsecurityguide.codeplex.com/releases/view/15892

我认为如果你描述你的情况并明确你需要完成什么,你会得到更多的回应。

但如果这有帮助,请务必给我一个代表:)

为什么要在配置文件中配置用户id和密码?更改服务运行的用户会更安全。这可以通过右键单击您的服务,选择属性,并在Log on选项卡上设置帐户来完成。

相关文章:
  • 没有找到相关文章