【发布时间】:2020-07-20 22:47:34
【问题描述】:
我已经使用 basichttpbinding 开发了一个 wcf 服务。我已经在 Web 服务器上托管了该服务。有一个负载均衡器通过 https url 公开此服务。当我尝试访问通过负载均衡器公开的端点地址时,它会在 wcf 测试客户端中引发错误 - “客户端身份验证方案‘匿名’禁止 HTTP 请求。” 下面是 web.config 的配置:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="testServiceBehavior">
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceSecurityAudit auditLogLocation="Application" suppressAuditFailure="false"
serviceAuthorizationAuditLevel="SuccessOrFailure" messageAuthenticationAuditLevel="SuccessOrFailure" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="testServiceBehavior" name="TestService">
<endpoint address="" binding="basicHttpBinding"
contract="TestService.IService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
【问题讨论】: