title: Working with netTcpBinding in Silverlight
body: <p>I Have created a WCF service that hosted in IIS 7</p>
  
  <p>My .NET version is 4.0</p>
  
  <p>My Operating System is Windows 7 Ultimate</p>
  
  <p>My Service Address:</p>
  
  <ul>
  <li>net.tcp://localhost:4504/WPFHost/tcp</li>
  </ul>
  
  <p>When i added service reference i get two warning:</p>
  
  <p>First:</p>
  
  <pre><code>Warning 2   Custom tool warning: Endpoint 'NetTcpBinding_IChat' at address 'net.tcp://localhost:4504/WPFHost/tcp' is not compatible with Silverlight 4. Skipping... D:\Projects\C#\WCF\SilverlightApplication1\SilverlightApplication1\Service References\SV\Reference.svcmap   1   1   SilverlightApplication1
  </code></pre>
  
  <p>Second:</p>
  
  <pre><code>Warning 3   Custom tool warning: No endpoints compatible with Silverlight 4 were found. The generated client class will not be usable unless endpoint information is provided via the constructor.  D:\Projects\C#\WCF\SilverlightApplication1\SilverlightApplication1\Service References\SV\Reference.svcmap   1   1   SilverlightApplication1
  </code></pre>
  
  <p>My service Appconfig file is like below:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
    &lt;system.web&gt;
      &lt;compilation debug="true"/&gt;
    &lt;/system.web&gt;
    &lt;system.serviceModel&gt;
      &lt;services&gt;
        &lt;service name="WCFService.Service"
                       behaviorConfiguration="behaviorConfig"&gt;
  
          &lt;host&gt;
            &lt;baseAddresses&gt;
              &lt;add baseAddress="net.tcp://localhost:4504/WPFHost/"/&gt;
              &lt;add baseAddress="http://localhost:4505/WPFHost/"/&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;
          &lt;endpoint address="tcp"
                            binding="netTcpBinding"
                            bindingConfiguration="tcpBinding"
                            contract="WCFChatLibrary.IChat"/&gt;
  
          &lt;endpoint address="net.tcp://localhost:4503/WPFHost/mex"
                            binding="mexTcpBinding"
                            contract="IMetadataExchange"/&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior name="behaviorConfig"&gt;
            &lt;serviceMetadata httpGetEnabled="true" httpGetUrl=""/&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
            &lt;serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100"/&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;bindings&gt;
        &lt;netTcpBinding&gt;
          &lt;binding name="tcpBinding"
                           maxBufferSize="67108864"
                           maxReceivedMessageSize="67108864"
                           maxBufferPoolSize="67108864"
                           transferMode="Buffered"
                           closeTimeout="00:00:10"
                           openTimeout="00:00:10"
                           receiveTimeout="00:20:00"
                           sendTimeout="00:01:00"
                           maxConnections="100"&gt;
            &lt;security mode="None"&gt;
            &lt;/security&gt;
            &lt;readerQuotas maxArrayLength="67108864"
                                    maxBytesPerRead="67108864"
                                    maxStringContentLength="67108864"/&gt;
            &lt;reliableSession enabled="true" inactivityTimeout="00:20:00"/&gt;
          &lt;/binding&gt;
        &lt;/netTcpBinding&gt;
      &lt;/bindings&gt;
    &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>When i call the service it throw exception. Here is my code:</p>
  
  <pre><code>if (this.proxy == null)
          {
              try
              {
                  this.StatusTxtBlock.Text = "Ready";
                  this.localClient = new Client();
                  this.localClient.Username = "User-" + Guid.NewGuid();
                  this.proxy = new ChatClient(new InstanceContext(this));
  
                  this.proxy.OpenAsync();
                  this.proxy.ConnectAsync(this.localClient);
                  this.proxy.ConnectCompleted += new EventHandler&lt;ConnectCompletedEventArgs&gt;(proxy_ConnectCompleted);
              }
              catch (Exception ex)
              {
                  this.StatusTxtBlock.Text = "Exception: "+ ex.Message;
              }
          }
  </code></pre>
  
  <p>and the exception is:</p>
  
  <pre><code>Exception: The given key was not present in the dictionary
  </code></pre>
  
  <p>I follow this <a href="http://tomasz.janczuk.org/2009/11/wcf-nettcp-protocol-in-silverlight-4.html" rel="nofollow">tutorial</a> but no luck</p>
  
  <p>I don't know what to do, my mind and vision is going to blank, maybe i'm going crazy. Please somebody save me (i mean help me).</p>