主にさまざまな言語でエラー メッセージと応答メッセージを提供するために、いくつかの異なるカルチャに合わせてローカライズする必要がある WCF サービスがあります。リクエスト ヘッダーから何かを解析することに頼るのではなく、サポート カルチャごとに異なるエンドポイントを提供する方向に傾いています。たとえば、次の行に沿ってさまざまな URL があります。
http://server/mycompany-rest/v1.0/service.svc
http://server/mycompany-rest/v1.0/service.svc/fr
http://server/mycompany-rest/v1.0/service.svc/cn
このアプローチを実現するには、次の行に沿って web.config で構成できる必要があると思います。
<system.serviceModel>
<services>
<service name="MyCompany.Service.Rest.SomeService">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="WebBehavior" contract="MyCompany.Service.Rest.ISomeService"/>
<endpoint address="fr" binding="webHttpBinding" behaviorConfiguration="WebBehaviorFrench" contract="MyCompany.Service.Rest.ISomeService"/>
<endpoint address="cn" binding="webHttpBinding" behaviorConfiguration="WebBehaviorChinese" contract="MyCompany.Service.Rest.ISomeService"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="WebBehavior">
<webHttp/>
</behavior>
<behavior name="WebBehaviorFrench">
<webHttp/>
<culture value="fr" />
</behavior>
<behavior name="WebBehaviorChinese">
<webHttp/>
<culture value="zh-cn" />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
エンドポイントの動作に文化要素がないことは理解していますが、この種のアプローチはカスタム動作で実現可能でしょうか? または、代わりにそれを行うより良い方法はありますか?