开发者

WCF AllowNTLM .net 3.5sp1 and IIS7.5

I am getting the following error using WCF, calling the a WCF Service on another server.

An error (The request was canceled) occurred while transmitting data over the HTTP channel.

The followi开发者_开发百科ng Services worked on a IIS7 Box on .net3, but we have recently upgraded to IIS7.5 and .net 3.5sp1, if I remove the AllowNtlm attribute out of the Config, the call gets further but does not pass allow the service to do a double hop to the database, i then get the follow error.

'NT AUTHORITY\ANONYMOUS LOGON'.

I have enclosed a copy of the client app.config, which worked using iis7, but

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

  <system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="Windows">
          <clientCredentials>
            <windows allowNtlm="false" allowedImpersonationLevel="Delegation"/>
          </clientCredentials>
          <dataContractSerializer maxItemsInObjectGraph="4194304"></dataContractSerializer>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding allowCookies="false" bypassProxyOnLocal="false" closeTimeout="00:01:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="4194304" maxReceivedMessageSize="4194304" messageEncoding="Text" name="BasicHttpBinding_CalculationWebService" openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:10:00" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxArrayLength="16384" maxBytesPerRead="4096" maxDepth="32" maxNameTableCharCount="16384" maxStringContentLength="8192"></readerQuotas>
          <security mode="TransportCredentialOnly">
            <message algorithmSuite="Default" clientCredentialType="UserName"></message>
            <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""></transport>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://server1.domain/WebServices/CacheManagement/CacheBusinessService.svc" behaviorConfiguration="Windows" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_CacheWebService" contract="CacheWCFService.CacheWebService" name="BasicHttpBinding_CacheWebService">
        <identity>
          <servicePrincipalName value="http/server1.domain"></servicePrincipalName>
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>
</configuration>

This is the Server Config, any ideas?

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="CacheManagementBehavior" name="Iris.WebServices.CacheManagement.CacheWebService">
        <endpoint address="" behaviorConfiguration="" binding="basicHttpBinding"
         bindingConfiguration="basicHttpBinding_CacheManagement" contract="Iris.WebServices.CacheManagement.CacheWebService" />
        <endpoint address="mex" behaviorConfiguration="" binding="basicHttpBinding"
         bindingConfiguration="basicHttpBinding_CacheManagement" contract="IMetadataExchange" />
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="basicHttpBinding_CacheManagement" maxReceivedMessageSize="4194304" receiveTimeout="00:30:00">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows"/>
            <message clientCredentialType="UserName"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="CacheManagementBehavior">
          <dataContractSerializer maxItemsInObjectGraph="4194304" ignoreExtensionDataObject="True"/>
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug httpHelpPageEnabled="true" includeExceptionDetailInFaults="true"/>
          <serviceAuthorization impersonateCallerForAllOperations="true"/>
        </behavior>a
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>


We managed to resolve the issue, by removing ServicePrincipleName from the config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

  <system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="Windows">
          <clientCredentials>
            <windows allowNtlm="false" allowedImpersonationLevel="Delegation"/>
          </clientCredentials>
          <dataContractSerializer maxItemsInObjectGraph="4194304"></dataContractSerializer>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding allowCookies="false" bypassProxyOnLocal="false" closeTimeout="00:01:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="4194304" maxReceivedMessageSize="4194304" messageEncoding="Text" name="BasicHttpBinding_CalculationWebService" openTimeout="00:01:00" receiveTimeout="00:30:00" sendTimeout="00:10:00" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxArrayLength="16384" maxBytesPerRead="4096" maxDepth="32" maxNameTableCharCount="16384" maxStringContentLength="8192"></readerQuotas>
          <security mode="TransportCredentialOnly">
            <message algorithmSuite="Default" clientCredentialType="UserName"></message>
            <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""></transport>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://server1.domain/WebServices/CacheManagement/CacheBusinessService.svc" behaviorConfiguration="Windows" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_CacheWebService" contract="CacheWCFService.CacheWebService" name="BasicHttpBinding_CacheWebService" />
    </client>
  </system.serviceModel>
</configuration>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜