tags:

views:

30

answers:

1

When I try to browse my service.svc file,I keep getting this error.

  1. I've enabled tcp in the default website in IIS.
  2. The port number 808:* is already there in my IIS bindings
  3. Ive installed WAS and support for non http protocols...
  4. TcpChannellistener service and tcp port sharing services are running..

But,now why am I unable to browse through the site? It keeps showing "The protocol 'net.tcp' is not supported."

Here's my code...

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Web.Services.Description;
using System.ServiceModel.Description;
using System.ServiceModel.Channels;
using System.IO;

namespace WcfService7
{
    public class clsMyOwnServiceHost:ServiceHostFactory
    {

               protected override ServiceHost CreateServiceHost( Type t, Uri[] baseAddresses )
               {

                   NetTcpBinding tcpbinding = new NetTcpBinding(SecurityMode.None);
                   BasicHttpBinding basicbinding = new BasicHttpBinding(BasicHttpSecurityMode.None);
                   WSHttpBinding wsbinding = new WSHttpBinding(SecurityMode.None);

                   baseAddresses = new Uri[] { new Uri("http://localhost/WcfService7/Service1.svc"),new Uri("net.tcp://localhost/WcfService7/Service1.svc/tcp") };
                   ServiceHost host = new ServiceHost(t, baseAddresses);
                   baseAddresses.ToList().ForEach(uri =>
                    {


                        //ServiceMetadataBehavior metabehavior = new ServiceMetadataBehavior();

                        //metabehavior.HttpGetEnabled = true;
                      //  host.Description.Behaviors.Add(metabehavior);
                        if (uri.AbsoluteUri.Contains("http://")) host.AddServiceEndpoint(typeof(IService1), basicbinding, "basic");
                      if(uri.AbsoluteUri.Contains("net.tcp://"))  host.AddServiceEndpoint(typeof(IService1),tcpbinding,"tcp");
                       if(uri.AbsoluteUri.Contains("http://")) host.AddServiceEndpoint(typeof(IService1), wsbinding, "ws");
                       if (uri.AbsoluteUri.Contains("http://")) host.AddServiceEndpoint(typeof(IService1), MetadataExchangeBindings.CreateMexHttpBinding(), "mex");



                    });

                   return host;
               }

    }
}

Please help me...

Thanks so much

A: 

You need to add the port for TCP for your uri. HTTP has a default port but TCP does not.

UPDATE

net.tcp is not installed on IIS by default. Make sure it is installed by going to add/remove features and check TCP is ticked.

There are 1001 different settings that must be correct. You need to have an application pool which runs 4.0 so if you have not created a separate app pool, do that and set it to 4.0 and let the application run in that.

Go to advanced properties for the site and on enabled protocols enter "http, tcp".

Aliostad
ive tried adding 808 too....still doesnt work :(...any other stuff that I could try?
dotnetgeek
Check my update.
Aliostad
net.tcp is installed...ive installed it...
dotnetgeek
Go to advanced properties for the site and on enabled protocols enter "http, tcp"
Aliostad
yes,thats also already enabled
dotnetgeek
Anything else that I could try?
dotnetgeek
Sorry cant think of anything
Aliostad