【问题标题】:WCF and FirewallWCF 和防火墙
【发布时间】:2009-03-04 19:24:15
【问题描述】:

我编写了一个非常简单的 WCF 服务(托管在 IIS 中)和与之对话的 Web 应用程序。如果它们都在同一个域中,则可以正常工作。但是当我将它们放在不同的域中(在防火墙的不同侧)时,Web 应用程序会说:

无法满足对安全令牌的请求,因为身份验证失败。说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。 异常详细信息:System.ServiceModel.FaultException:由于身份验证失败,无法满足对安全令牌的请求。 源错误: 在执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常起源和位置的信息。

服务 web.config 的相关部分是:

<system.serviceModel>
<services>
  <service behaviorConfiguration="MigrationHelperBehavior"
    name="MigrationHelper">
    <endpoint address="" binding="wsHttpBinding" contract="IMigrationHelper">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />        <endpoint  binding="httpBinding" contract="IMigrationHelper" />       </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="MigrationHelperBehavior">
      <!-- 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>
</system.serviceModel> 

网络应用程序(客户端)web.config 说:

<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IMigrationHelper" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
    <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false"/>
    <security mode="Message">
        <transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
        <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" establishSecurityContext="true"/>
    </security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://mydomain.com/MigrationHelper.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMigrationHelper" contract="MyNewServiceReference.IMigrationHelper" name="WSHttpBinding_IMigrationHelper">
<identity>
    <dns value="localhost"/>
</identity>
</endpoint>
</client>
</system.serviceModel>

我相信这两个只是 VS 2008 为我创建的默认设置。

所以我的问题是,当服务和客户端不在同一个域中时,如何配置它们?

谢谢 .吉姆·比迪森

【问题讨论】:

    标签: wcf


    【解决方案1】:

    您似乎想要/正在使用 Windows 身份验证,在跨域情况下,用户凭据通常是不同的。 这似乎不是防火墙问题。

    要解决默认的 Windows 身份验证,请使用证书或不使用任何内容。

    【讨论】:

      【解决方案2】:

      有关如何设置 WCF 跟踪,请参阅对 my question 的回复。 如何为服务的 Web 应用程序配置安全性?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多