我的 UWP 应用如何使用 WCF 服务进行身份验证?
How can my UWP app authenticate with a WCF service?
我正在用 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
文件并添加了 企业身份验证 和 专用网络(客户端和服务器) 功能。这解决了问题。
我正在用 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
文件并添加了 企业身份验证 和 专用网络(客户端和服务器) 功能。这解决了问题。