我正在用 C# 编写一个 UWP 应用程序,并尝试让它使用来自(预先存在的)WCF 服务的数据。我在网上找不到有关该主题的任何信息。我的代码如下所示(WCF 服务是 Serv
,服务命名空间是 Ns
):
var config = Ns.ServClient.EndpointConfiguration.BasicHttpBinding_IServ;
var client = new Ns.ServClient(config);
var result = client.TestCall();
我收到以下异常,我不明白如何解析:
Exception thrown: 'System.ServiceModel.Security.MessageSecurityException' in mscorlib.ni.dll
Additional information: The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate, NTLM'.
这个错误信息是什么意思?如何成功使用 WCF 服务进行身份验证?
额外问题:ServiceReferences.Designer.ClientConfig
文件是什么?我该如何使用它?
最佳答案
我打开了 Package.appxmanifest
文件并添加了企业身份验证和专用网络(客户端和服务器)功能。这解决了问题。
关于wcf - 我的 UWP 应用如何使用 WCF 服务进行身份验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37667619/