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

标签 c# wcf basic-authentication

我可以在哪里为使用 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服务下?

最佳答案

您是否尝试将 Windows 凭据传递给您的服务?或提供它作为回应?我不是 100% 清楚你想要完成什么。

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

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

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

How to specify Windows credentials in WCF client configuration file

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

如果您描述您的情况并阐明您需要完成什么,我想您会得到更多的回复。

但如果这对我有帮助,请授予我代表 :)

关于c# - Windows 服务中托管的 WCF basicHttpBinding 设置凭据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8121506/

相关文章:

c# - 用于静态泛型类?

asp.net - web.config可以从外部xml文件读取吗?

WCF WebInvoke 响应格式

http - 基本的 CouchDB 本地到远程复制

javascript - 使用 Node.js 和 restify 进行基本身份验证

go - 访问基本身份验证凭据

c# - 找不到类型或命名空间名称 'Bussen'(您是否缺少 using 指令或程序集引用?)

c# - 如何在 Visual Studio 2010 中调试从另一个进程启动的 C# .NET 应用程序

c# - 如何将 48bpp 图像的原始数据加载到位图中?

.net - WCF 与方法 IDispatchMessageInspector.AfterReceiveRequest 的返回有什么关系?