wcf - WSHttpBinding 和 HTTP 和 Windows 身份验证

标签 wcf http authentication wshttpbinding

我尝试使用 WSHttpBinding 和 Windows 身份验证和 HTTP 协议(protocol)(​​而非 HTTPS)设置 WCF 服务。是否可以?我正在使用 IIS 7。当前我的配置文件如下。

使用此配置应用程序抛出异常:

Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding. Registered base address schemes are [].

我的代码是:

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WsBehavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <services>
      <service behaviorConfiguration="WsBehavior" name="LoginService">
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WsBinding" contract="ILoginService">
          <identity>
            <dns value="http://localhost:50001/Ws/" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
    </services>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" minFreeMemoryPercentageToActivateService="1">
      <baseAddressPrefixFilters>
        <add prefix="http://localhost:50001/Ws/" />
      </baseAddressPrefixFilters>
    </serviceHostingEnvironment>

    <bindings>
      <wsHttpBinding>
        <binding name="WsBinding" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="Windows" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
  </system.serviceModel>

最佳答案

我遇到了下一个错误

The authentication schemes configured on the host ('IntegratedWindowsAuthentication') do not allow those configured on the binding 'WSHttpBinding' ('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.

所以回答我的问题。这是不可能的。

关于wcf - WSHttpBinding 和 HTTP 和 Windows 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12596274/

相关文章:

java - 如何在 s :url tag? 中动态设置方案属性

python - 为什么我获取不到这个http_response的状态码?

php - 单独使用 PHP 是否可以轻松满足我的要求,或者我是否可以从 CMS 之类的东西中受益?

asp.net - 使用表单例份验证的单点登录

c# - Visual Studio "Add Service Reference"不断将 "extendedProtectionPolicy"添加到我的配置文件

c# - 添加服务引用为枚举和方法创建重复的定义

wcf - Powershell:使用 MTOM 消息编码使用 WCF 服务时出错

.net - 我应该将服务属性应用于接口(interface)、具体类还是两者?

Java 小服务程序 : File download breaks when user navigates away from page

android - TextField controlled controller.addListener(() 在使用 controller.clear 后被多次调用