开发者

WCF configuration for multiple site bindings

开发者 https://www.devze.com 2023-03-19 16:13 出处:网络
Im trying to setup my config for my WCF service correctly. On our web server we are going to have a Service that is both accessible to Extenal internet users and Internal users.

Im trying to setup my config for my WCF service correctly.

On our web server we are going to have a Service that is both accessible to Extenal internet users and Internal users.

to access the site externally you will go to http://services.ourdomain.com to access the site internally you will go to http://serverna开发者_开发技巧me:9090

I'd like to configure how the users are authenticated. so for external i will use a usernamevalidator and internal for now just have no authentication, but this may change in future.

how can i setup my config file that when access to the service is coming externally it will use the customvalidator but for internal it will just use regular basicHttpBinding?


Try something like this in your service config:

<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>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号