我正在绕圈转转,我可以使用一些支持。
我想设置HTTPS WCF服务,并且需要传递用户的Windows凭据以进行进一步的通信。 我使用这篇文章“ {Pass Windows credentials to remote https WCF service”作为基础,但是当我使用此处所述的解决方案时,我遇到了麻烦。
我的Web.config如下所示:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.7" />
<httpRuntime targetFramework="4.7"/>
<customErrors mode="Off" />
<authentication mode="Windows" />
<identity impersonate="true"/>
<authorization>
<allow users="*" />
<deny users="?" />
</authorization>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="httpsBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="Schindler.LPD.SharePoint.Service.SharePointService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="httpsBinding" contract="Schindler.LPD.SharePoint.Service.ISharePointService"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
</configuration>
我可以使用该设置调用方法,但是我没有Windows凭据(ServiceSecurityContext.Current.WindowsIdentity):
<transport clientCredentialType="None"/>
但是当我将其更改为:
<transport clientCredentialType="Windows"/>
我无法进行方法调用失败,并且在客户端我收到异常:
System.ServiceModel.Security.MessageSecurityException:
'The HTTP request is unauthorized with client authentication scheme 'Negotiate'.
The authentication header received from the server was 'Negotiate oXkwd6ADCgEBonAEbmBsBgkqhkiG9xIBAgIDAH5dMFugAwIBBaEDAgEepBEYDzIwMTgwODIzMTE0ODMxWqUFAgMGvaCmAwIBKakWGxRHTE9CQUwuU0NISU5ETEVSLkNPTaoYMBagAwIBAaEPMA0bC3RyZHdzcjAwMjQk'.'
有人可以告诉我消息安全异常来自何处,如何解决此问题?