我正在使用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>
答案 0 :(得分:0)
您可能希望了解的一些事情是您已关闭serviceMetadata。如果您不发布端点,任何客户端都无法发现您的端点。启用它后,您需要提供一个http地址来发布数据。