WCF AllowNTLM .net 3.5sp1 и IIS7.5 - PullRequest
       5

WCF AllowNTLM .net 3.5sp1 и IIS7.5

2 голосов
/ 08 февраля 2011

При использовании WCF я получаю следующую ошибку, вызывая службу WCF на другом сервере.

Произошла ошибка (запрос был отменен) при передаче данных по каналу HTTP.

Следующие службы работали на IIS7 Box на .net3, но мы недавно обновились до IIS7.5 и .net 3.5sp1. Если я удалю атрибут AllowNtlm из Config, вызов будет продолжен, ноне пропустите, разрешите службе выполнить двойной переход к базе данных, затем я получу следующую ошибку.

'NT AUTHORITY \ ANONYMOUS LOGON'.

Я приложилкопия клиентского app.config, который работал с использованием iis7, но

<?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>

Это Конфигурация сервера, есть идеи?

<?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>

1 Ответ

2 голосов
/ 10 февраля 2011

Нам удалось решить проблему, удалив ServicePrincipleName из конфигурации

<?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>
...