Error while adding service reference to client WCF

863 views Asked by At

I am working with persession instance and i have created a service with net.tcp binding and a client when i am adding the reference i am getting an error like

Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it.

my 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>
1

There are 1 answers

3
stephenl On

A couple of things you might want to look at is that you have serviceMetadata turned off. No client will ever be able to discover your endpoint if you don't publish it. Once you enable it you need to provide a http address to publish the data.