gpt4 book ai didi

c# - 在主机 ('Basic' 上配置的身份验证方案不允许在绑定(bind) 'BasicHttpBinding' 上配置的那些

转载 作者:行者123 更新时间:2023-11-30 20:40:01 25 4
gpt4 key购买 nike

错误

The authentication schemes configured on the host ('Basic') do not allow those configured on the binding 'BasicHttpBinding' ('Anonymous'). Please ensure that the SecurityMode is set to Transport or TransportCredentialOnly. Additionally, this may be resolved by changing the authentication schemes for this application through the IIS management tool, through the ServiceHost.Authentication.AuthenticationSchemes property, in the application configuration file at the element, by updating the ClientCredentialType property on the binding, or by adjusting the AuthenticationScheme property on the HttpTransportBindingElement.

你知道web.config哪里有问题吗?我尝试使用 Windows 凭据通过基本身份验证登录 WCF。

<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Windows" />
<customErrors mode="Off"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- 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="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="basicEndpoint">
<security mode="Transport" >
<transport clientCredentialType="Basic"
proxyCredentialType="None"
realm="" />
</security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="BasicAuthHttpModule"
type="Wt.BasicAuthHttpModule, Wt"/>
</modules>
</system.webServer>

</configuration>

enter image description here

最佳答案

看来您正在使用 Simplified Configuration for WCF Services .

如果您没有明确指定端点服务及其绑定(bind)配置,WCF 将执行以下操作:

  • 它将默认绑定(bind)关联到所使用的协议(protocol)(方案)。
  • 它将加载绑定(bind)类型的默认绑定(bind)配置。

对于协议(protocol)映射,请参阅此说明 Simplified Configuration

默认的 bindingConfiguration 没有名字,所以如果你给你的 basicHttpBinding 配置一个特定的名字,你就不会覆盖默认的绑定(bind)配置。应该是

<basicHttpBinding>
<binding>
<security mode="Transport">
<transport clientCredentialType="Basic"
proxyCredentialType="None"
realm="" />
</security>
</binding>
</basicHttpBinding>

关于c# - 在主机 ('Basic' 上配置的身份验证方案不允许在绑定(bind) 'BasicHttpBinding' 上配置的那些,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33804027/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com