【发布时间】:2011-10-27 11:20:47
【问题描述】:
我已经指定了需要会话的服务合同。
[ServiceContract(SessionMode = SessionMode.Required)]
public interface ITicketSales
{
}
这样装饰的服务:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Single)]
public class TicketSalesService : ITicketSales
{
}
这是我的 App.config 文件:
<system.serviceModel>
<services>
<service name="InternetRailwayTicketSales.TicketSalesImplementations.TicketSalesService" behaviorConfiguration="defaultBehavior">
<host>
<baseAddresses>
<add baseAddress = "https://localhost/TicketSales/"></add>
</baseAddresses>
</host>
<endpoint address="MainService" binding="wsHttpBinding" bindingConfiguration="wsSecureConfiguration"
contract="InternetRailwayTicketSales.TicketSalesInterface.ITicketSales" />
<endpoint address="mex" binding="mexHttpsBinding"
contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="wsSecureConfiguration">
<security mode="Transport">
<transport clientCredentialType="None"></transport>
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="defaultBehavior">
<serviceThrottling maxConcurrentInstances="5000" maxConcurrentSessions="5000"/>
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
当我按 F5 时,我收到错误消息“合同需要 Session,但绑定‘WSHttpBinding’不支持或未正确配置以支持它。”
我真的需要支持 SSL 并且需要会话的频道。
【问题讨论】:
-
我认为这个问题是重复的stackoverflow.com/questions/2650738/…
-
如果 WCF 不允许以安全的方式创建通道并同时提供会话,那么我对这项技术非常失望。这是 Web 服务中非常常见的场景。真的,我快要生气了。
标签: wcf binding ssl wshttpbinding