无法将SharePoint WCF服务与客户端笔​​记本电脑的SSL证书结合使用

我的测试环境是:

  • 1 * Server ::具有WCF服务的SharePoint网站(在ISAPI文件夹中),我们在其上配置了SSL和证书。
  • 1 *客户端::具有一个涉及WCF服务的控制台应用程序的Windows 10

测试(1):SharePoint Server上的所有程序(WCF服务和控制台应用程序)

我创建了一个控制台应用程序以在SharePoint中调用WCF服务。同时,控制台应用程序和WCF在同一服务器上。结果是一切正常。将文件上传到文档库成功。

测试(2):模拟我的客户端环境:

  • 1 * SharePoint:WCF服务
  • 1 * Windows 10:控制台应用程序

结果失败,我得到了错误消息:

  

HTTP请求未经客户端身份验证方案“匿名”授权。从服务器收到的身份验证标头为“ NTLM”

说实话,我在这里住了一段时间。我还列出了部分源代码,供有经验的人参考。我还在here中发布了一些示例代码和web.config。

aws8v111g2r 回答:无法将SharePoint WCF服务与客户端笔​​记本电脑的SSL证书结合使用

已更新。
如果启用NTLM身份验证,则必须启用Windows身份验证。
enter image description here
然后,在调用服务时,我们需要提供Windows凭据。

//it will use the binding and service endpoint address in the system.servicemode section.
        ServiceReference1.ServiceClient client = new ServiceReference1.ServiceClient();
                //windows account on the server.
                client.ClientCredentials.Windows.ClientCredential.UserName = "administrator";
                client.ClientCredentials.Windows.ClientCredential.Password = "abcd1234!";
                try
                {
                    Console.WriteLine(client.SayHello());
                }
                catch (Exception)
                {
                    throw;
                }

自动生成的配置。

   <system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IService">
                <security mode="Transport">
                    <transport clientCredentialType="Ntlm" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
    <client>
        <endpoint address="https://vabqia969vm:21011/" binding="wsHttpBinding"
            bindingConfiguration="WSHttpBinding_IService" contract="ServiceReference1.IService"
            name="WSHttpBinding_IService">
            <identity>
                <userPrincipalName value="VABQIA969VM\Administrator" />
            </identity>
        </endpoint>
    </client>
</system.serviceModel>

请随时让我知道问题是否仍然存在。

本文链接:https://www.f2er.com/3128456.html

大家都在问