SVC 服务的 Web 配置中的安全设置

本文关键字:安全 设置 Web 服务 SVC 配置 | 更新日期: 2023-09-27 18:33:39

所以,我想从wcf服务获取数据,http://www.domain/Service.svc。要访问,您需要一个纯文本格式的标题授权:username_value:password_value。但是,当我尝试从 Service.svc 获取数据时,我收到 400 错误请求。我的猜测是必须相应地设置安全部分。我现在的设置是:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IService" closeTimeout="00:01:00">
                <security mode="None">
                    <transport clientCredentialType="None" proxyCredentialType="None" />
                    <message clientCredentialType="UserName"  />
                </security>

这样可以吗?谢谢。

SVC 服务的 Web 配置中的安全设置

使用:

<security mode="Transport">
    <transport clientCredentialType="UserName" proxyCredentialType="None" />
</security>