Мне нужна помощь в настройке WCF для поддержки нескольких сред. В одной среде возможна анонимная проверка подлинности по стандартному HTTP, а в другой используется проверка подлинности Windows по SSL.
Я могу настроить WCF для поддержки любой из сред, но не обеих в одном файле web.config.
Вот что позволяет анонимный доступ через http:
<behaviors>
<serviceBehaviors>
<behavior name="MexBehavior" >
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="DLAspNetAjaxBehavior">
<enableWebScript/>
</behavior>
<behavior name="Service1AspNetAjaxBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<service name="DL" behaviorConfiguration="MexBehavior">
<endpoint address="" behaviorConfiguration="DLAspNetAjaxBehavior" binding="webHttpBinding" contract="DLService"/>
<endpoint name="MEXEndpoint" contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
<service name="Service1" behaviorConfiguration="MexBehavior">
<endpoint address="" behaviorConfiguration="Service1AspNetAjaxBehavior" binding="webHttpBinding" contract="Service1"/>
<endpoint name="MEXEndpoint" contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
А вот что работает для аутентификации Windows по SSL:
<behaviors>
<serviceBehaviors>
<behavior name="MexBehavior" >
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="DLAspNetAjaxBehavior">
<enableWebScript/>
</behavior>
<behavior name="Service1AspNetAjaxBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<service name="DL" behaviorConfiguration="MexBehavior">
<endpoint address="" behaviorConfiguration="DynamicLoaderAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="webWinBinding" contract="DLService"/>
<endpoint name="MEXEndpoint" contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
<service name="Service1" behaviorConfiguration="MexBehavior">
<endpoint address="" behaviorConfiguration="ValidValuesServiceAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="webWinBinding" contract="Service1"/>
<endpoint name="MEXEndpoint" contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webWinBinding">
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</webHttpBinding>
</bindings>
Когда я добавляю конечную точку из конфигурации SSL в конфигурацию, отличную от SSL, анонимная служба прерывается.
Вот файл конфигурации, который не работает, но пытается объединить обе настройки:
<behaviors>
<serviceBehaviors>
<behavior name="MexBehavior" >
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="DLAspNetAjaxBehavior">
<enableWebScript/>
</behavior>
<behavior name="Service1AspNetAjaxBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<service name="DynamicLoader" behaviorConfiguration="MexBehavior">
<endpoint name="basic" address="" behaviorConfiguration="DLAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="webAnonymousBinding" contract="DLService"/>
<endpoint name="secure" address="" behaviorConfiguration="DLAspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="webWinBinding" contract="DLService"/>
<endpoint name="MEXEndpoint" contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
<service name="ValidValuesService" behaviorConfiguration="MexBehavior">
<endpoint name="basic" address="" behaviorConfiguration="Service1AspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="webAnonymousBinding" contract="Service1"/>
<endpoint name="secure" address="" behaviorConfiguration="Service1AspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="webWinBinding" contract="Service1"/>
<endpoint name="MEXEndpoint" contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webWinBinding">
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
<binding name="webAnonymousBinding">
<security mode="None">
</security>
</binding>
</webHttpBinding>
</bindings>
Есть ли способ объединить конечные точки в один web.config для поддержки двух сред?