0

我有一个 WCF 服务,它也使用一个共享点用户配置文件服务。当我尝试在 IIS 上运行服务时出现此错误。

在主机('IntegratedWindowsAuthentication')上配置的身份验证方案不允许在绑定'WSHttpBinding'('Anonymous')上配置的那些。请确保将 SecurityMode 设置为 Transport 或 TransportCredentialOnly。此外,可以通过 IIS 管理工具、通过 ServiceHost.Authentication.AuthenticationSchemes 属性、在元素的应用程序配置文件中更改此应用程序的身份验证方案、通过更新绑定上的 ClientCredentialType 属性或通过调整来解决此问题HttpTransportBindingElement 上的 AuthenticationScheme 属性。

这是我的 web.config

<bindings>
<basicHttpBinding>

    <binding name="UserProfileServiceSoap" closeTimeout="00:01:00"
    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
    useDefaultWebProxy="true">
    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
    <security mode="TransportCredentialOnly">
    <transport clientCredentialType="Ntlm" proxyCredentialType="None" realm="" />
    <message clientCredentialType="UserName" algorithmSuite="Default" />
    </security>
    </binding>

</basicHttpBinding>
<wsHttpBinding>

    <binding name="HttpBinding1" maxReceivedMessageSize="2147483647" receiveTimeout="10:00:00" openTimeout="10:00:00"
    sendTimeout="10:00:00" closeTimeout="10:00:00" bypassProxyOnLocal="false" transactionFlow="false"
    hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288000" allowCookies="false">
    <security mode="None"/>
    </binding>

    <binding name="WSHttpBinding_MessageSecurity" maxReceivedMessageSize="2147483647" receiveTimeout="10:00:00"
    openTimeout="10:00:00" sendTimeout="10:00:00" closeTimeout="10:00:00" bypassProxyOnLocal="false"
    transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288000" allowCookies="false">
    <security mode="Message">
    <transport clientCredentialType="Windows" proxyCredentialType="None" realm="">
    <extendedProtectionPolicy policyEnforcement="Never"/>
    </transport>
    <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/>
    </security>
    </binding>

</wsHttpBinding>
</bindings>

services>
<service name="UserProfileWcf.UserProfileService" behaviorConfiguration="UserProfileWcf.UserProfileServiceBehavior">
<!-- Service Endpoints -->
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="HttpBinding1" contract="UserProfileWcf.ServiceContract.IUserProfileService" name="UserProfileServiceEndpoint">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="UserProfileWcf.UserProfileServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="65536000"/>
<serviceThrottling maxConcurrentSessions="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
        <client>
            <endpoint address="http://xyz/_vti_bin/userprofileservice.asmx"
                    binding="basicHttpBinding" bindingConfiguration="UserProfileServiceSoap"
                    contract="SharePointUserProfileService.UserProfileServiceSoap"
                    name="UserProfileServiceSoap" />
        </client>

相同的配置在我的本地机器上运行良好。我的绑定哪里出错了?

4

1 回答 1

1

我认为您使用 wsHttpBinding 为端点之一定义的配置是 HttpBinding1,它的安全模式设置为无。当您在 IIS 中托管服务时(因此 IIS 充当服务主机),您似乎使用了 Windows 身份验证。尝试将安全模式设置为 HttpBinding1 的传输,或者尝试将 IIS 身份验证更改为匿名以查看它是否有效。

于 2013-07-12T08:15:57.760 回答