lundi 17 mai 2021

The authentication header received from the server was 'Negotiate' Inner Exception: The remote server returned an error: (401) Unauthorized

WCF: InnerException: The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate'. InnerException: The remote server returned an error: (401) Unauthorized.

Server Config:

<services>
      <service name="WCF.FunctionalMonitoringService">        
            <endpoint name="DatabaseServiceEndPoint" address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_AppService" contract="IDbAccessFacadeServiceContract"/>
            <endpoint name="ServiceEndPoint" address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_AppService" contract="IServicesServiceContract"/>
      </service>      
</services>
<bindings>
      <basicHttpBinding>
            <binding name="BasicHttpBinding_AppService" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" closeTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00">
                <readerQuotas maxDepth="64" maxStringContentLength="10000000" maxArrayLength="10000000" maxBytesPerRead="10000000" maxNameTableCharCount="10000000" />
                <security mode="Transport">
                    <transport clientCredentialType="Windows"/>
                </security>
            </binding>        
      </basicHttpBinding>
 </bindings>

Client Config:

<client>
      <endpoint name="DatabaseServiceEndPoint" address="http://***/FunctionalMonitoringService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_AppSecurityService"
                          contract="IDbAccessFacadeServiceContract" />
      <endpoint name="ServiceEndPoint" address="http://***/FunctionalMonitoringService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_AppSecurityService" contract="IServicesServiceContract" />
 </client>

<bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_AppSecurityService" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" closeTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00">
          <readerQuotas maxDepth="64" maxStringContentLength="10000000" maxArrayLength="10000000" maxBytesPerRead="10000000" maxNameTableCharCount="10000000" />
          <security mode="Transport">
            <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
            <message clientCredentialType="UserName" algorithmSuite="Default"/>
          </security>
        </binding>
        <binding name="ReportingService2010Soap" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Ntlm" proxyCredentialType="None" realm=""/>
            <message clientCredentialType="UserName" algorithmSuite="Default"/>
          </security>
        </binding>
      </basicHttpBinding>
</bindings>

I am calling another one endpoint via code which is using 'ReportingService2010Soap' binding.

I have two client(WPF click once application) and one server where WCF deployed.

Client 1: Above code works fine without any issues.

Client 2: In page load I am calling both end points to verify both endpints are active. In above configuration I am getting this error and page itself not loading. Then I enabled WCF trace, in that calling BasicHttpBinding_AppSecurityService endpoint and throwing InnerException: The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate'. InnerException: The remote server returned an error: (401) Unauthorized. ReportingService2010Soap calls return result.

But If I remove this endpoint ReportingService2010Soap page loading without any issue.

So I am confusing where is error? either 1st endpoint or 2nd endpoint. If I remove 2nd endpoint application loading fine and If I enable application throws error in 1st endpoint.

I have enabled Windows Authentication and provider is 'Negotiate' in IIS.

Please check am I missing anything?




Aucun commentaire:

Enregistrer un commentaire