0

我正在使用 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>
4

1 回答 1

0

您可能想要查看的几件事是您已关闭 serviceMetadata。如果您不发布端点,任何客户端都无法发现您的端点。一旦启用它,您需要提供一个 http 地址来发布数据。

于 2013-09-02T12:31:57.043 回答