向客户端WCF添加服务引用时出错
我正在使用persession实例,我创建了一个带有net.tcp绑定的服务和一个客户端,当我添加引用时,我得到了如下错误 协定需要会话,但绑定“BasicHttpBinding”不支持会话,或者未正确配置以支持会话 我的web.config向客户端WCF添加服务引用时出错,wcf,service-reference,net.tcp,Wcf,Service Reference,Net.tcp,我正在使用persession实例,我创建了一个带有net.tcp绑定的服务和一个客户端,当我添加引用时,我得到了如下错误 协定需要会话,但绑定“BasicHttpBinding”不支持会话,或者未正确配置以支持会话 我的web.config <?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetFramework="4
<?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>
您可能需要了解的几件事是,您已经关闭了serviceMetadata。如果您不发布端点,任何客户端都无法发现它。启用后,需要提供一个http地址来发布数据 由于我使用的是net.tcp,我认为没有必要启用servicemetadata,即使我已设置为true,但仍然存在相同的错误。正如Stephell提到的,您必须提供http地址才能发布数据。在VS中添加服务引用时,svcutil.exe将查找此http地址以检索服务information@chandrasekhar你是怎么主持的?您使用的是什么版本的WCF?