【问题标题】:WCF service - Getting Runtime error in basicHttpBinding configuration transport clientCredentialType to BasicWCF 服务 - 在 basicHttpBinding 配置传输 clientCredentialType 到 Basic 中出现运行时错误
【发布时间】:2014-10-17 11:35:45
【问题描述】:

我创建了一个 Web 服务,并且正在使用 basicHttpBinding,但问题是当我将 clientCredentialType 设置为 None 时,我可以访问该服务,但如果我设置为 Basic/Windows,我会收到类似“运行时错误”的错误。在 IIS 中使用基本身份验证。我需要 basicHttpbinding 的安全性。如何解决此问题。

Web.Config 中的代码:

<services>
      <service name="HealthCareService" behaviorConfiguration="Behavior_Service1">
        <endpoint address="" contract="IHealthCareService" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding1"  />
<endpoint address="mex" contract="IMetadataExchange" binding="mexHttpBinding"/>
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="basicHttpBinding1">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Basic" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Behavior_Service1">
          <serviceThrottling maxConcurrentSessions="10000"/>
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

错误屏幕截图:

【问题讨论】:

  • 首先,按照错误页面的提示进行操作并设置。这将显示基本异常和堆栈跟踪。获取并发布它们。
  • @simonatrcl 500 - 内部服务器错误。您要查找的资源有问题,无法显示。在自定义模式设置为关闭后显示
  • @my1 - 查看事件查看器,看看那里是否记录了任何内容。您的服务很可能会引发未处理的异常。
  • 向我们展示您的网址,同时告诉我们您如何托管服务?是 IIS 吗? IIS快递?还是自托管?还要显示您的完整 web.config,因为我看不到您的基地址或服务激活。最后,您使用的是哪个 .net 框架版本?
  • @Roman 当我将 clientCredentialType 设置为 basic 但在 IIS 中启用了基本身份验证时,我收到此错误。当我将 clientCredentialType 设置为 None 时,我可以访问该服务。

标签: c# asp.net .net wcf


【解决方案1】:

在 WCF 服务器 as described in this MSDN article 上启用跟踪。跟踪应该为您提供足够的信息来解决问题。

如果它与clientCredentialType = None一起使用,可能是您的客户端配置不正确-客户端和服务器的配置需要兼容。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-10
    • 1970-01-01
    • 2011-03-09
    • 1970-01-01
    • 2012-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多