【问题标题】:WCF configuration for multiple site bindings多个站点绑定的 WCF 配置
【发布时间】:2011-07-13 01:21:07
【问题描述】:

我正在尝试为我的 WCF 服务正确设置配置。

在我们的网络服务器上,我们将拥有一个可供外部互联网用户和内部用户访问的服务。

要从外部访问该站点,您将转到 http://services.ourdomain.com 要在内部访问该站点,您将转到 http://servername:9090

我想配置用户的身份验证方式。所以对于外部我将使用一个用户名验证器和内部现在只是没有身份验证,但这可能会在未来改变。

我如何设置我的配置文件,当对服务的访问来自外部时,它将使用 customvalidator,但对于内部,它将只使用常规的 basicHttpBinding?

【问题讨论】:

    标签: wcf iis-7 web-config wcf-security


    【解决方案1】:

    在你的服务配置中尝试这样的事情:

    <services>
        <service name = "MyService">
            <endpoint address = "http://services.ourdomain.com" binding = "customBinding"/>
            <endpoint address = "http://servername:9090" binding = "basicBinding"/>
        </service>
    </services>
    
    <bindings>
        <binding name = "basicBinding">
            <security mode = "None"/>
        </binding>
        <binding name = "customBinding">
            <security mode = "Message">
                <message clientCredentialType="UserName">
            </security>
        </binding>
    </bindings>
    

    【讨论】:

    • 如果我指定 2 个不同的地址,我会收到以下错误:“当 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' 在配置中设置为 true 时,端点需要指定相对地址。如果您在端点上指定相对侦听 URI,则地址可以是绝对地址。要解决此问题,请为端点指定相对 uri”我需要禁用 multipleSiteBindingsEnabled 吗?
    猜你喜欢
    • 2013-06-16
    • 2018-12-13
    • 2011-02-11
    • 1970-01-01
    • 2011-07-06
    • 2011-06-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多