我正在使用 persession 实例,并且当我添加引用时,我已经创建了一个带有 net.tcp 绑定和客户端的服务,我收到了一个错误,例如
合同需要 Session,但 Binding 'BasicHttpBinding' 不支持它或未正确配置以支持它。
我的 web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NewBinding0" portSharingEnabled="true">
<reliableSession inactivityTimeout="00:10:00" enabled="true" />
</binding>
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="servicbeha" name="asdad">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="NewBinding0"
name="tcpbind" contract="Wcfexam.IService1" />
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
name="mextcp" bindingName="" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://chandu-PC:8080/Wcfexam/Service1.svc" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="servicbeha">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>