C# 授权方案中.NET Core上的WCF缺少客户端协商方案
将WCF服务和ASP.NET核心网站移动到服务器后,出现以下错误:C# 授权方案中.NET Core上的WCF缺少客户端协商方案,c#,wcf,asp.net-core,credentials,C#,Wcf,Asp.net Core,Credentials,将WCF服务和ASP.NET核心网站移动到服务器后,出现以下错误: The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'Negotiate, NTLM'. 我仅使用以下web.config在WCF服务上启用了Windows身份验证: <system.serviceModel>
The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'Negotiate, NTLM'.
我仅使用以下web.config在WCF服务上启用了Windows身份验证:
<system.serviceModel>
<client />
<behaviors>
<serviceBehaviors>
<behavior name="authBehavior">
<serviceAuthorization principalPermissionMode="UseWindowsGroups">
<authorizationPolicies>
<add policyType="WCF.AuthorizationPolicy, WCF" />
</authorizationPolicies>
</serviceAuthorization>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WCF.IdentityValidator, WCF" />
<serviceCertificate findValue="16E86CCAFFE6211DAE6E841B984F71FB7609D349" storeLocation="LocalMachine" x509FindType="FindBySerialNumber" storeName="My" />
</serviceCredentials>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpsBinding>
<binding name="basicHttpsEndpointBinding" maxReceivedMessageSize="1073741824" maxBufferSize="1073741824" maxBufferPoolSize="1073741824">
<readerQuotas maxDepth="32" maxArrayLength="1073741824" maxStringContentLength="1073741824" />
<security mode="Transport">
<transport clientCredentialType="Ntlm" />
</security>
</binding>
</basicHttpsBinding>
</bindings>
<services>
<service name="WCF.MyService" behaviorConfiguration="authBehavior">
<endpoint address="" binding="basicHttpsBinding" bindingConfiguration="basicHttpsEndpointBinding" contract="WCF.IMyService">
<identity>
<dns value="example.com" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
我想不出什么是错的。如果在config/code中将Ntlm更改为Windows,则客户端身份验证方案“协商”会出错。我是否可以同时使用这两种方法,或者必须从IIS中删除/Ntlm
谢谢你的建议
解决方案强>
第1条中的方法1
需要重新启动服务器 我找到了这篇文章,它为我的问题提供了解决方案 第条: 使用方法1。需要重新启动服务器 在注册表中,我使用了CNAME
mySubdomain
mySubdomain.myDomain.com
localhost
192.168.0.xxx
192.168.0.1 (default gateway)
xx.xx.xx.xx (my ip address)
您可能会发现见解深刻。如果已经编写了另一个项目,并且它在本地主机上工作,但在服务器上不工作,那就太糟糕了:D无论如何,我通过阅读文章解决了问题:解决了我的问题发布解决方案作为答案并接受它。当然。。我只需等2天就可以接受它:D
mySubdomain
mySubdomain.myDomain.com
localhost
192.168.0.xxx
192.168.0.1 (default gateway)
xx.xx.xx.xx (my ip address)