This project is read-only.

Metadata exchange for netTcp endPoints

Topics: Technical Questions
Feb 12, 2010 at 8:34 PM

I can't figure out what I need to do to enable metadata exchange for my virtual netTcp endpoints.

//Mikael

Feb 18, 2010 at 1:05 AM

for tcp and named pipe bindings, the mex endpoint is automatically enabled. 

if you have a virtual service at 'net.tcp://9210/tcpService' the mex endpoint will be 'net.tcp://9210/tcpService/mex'

 

Feb 19, 2010 at 12:19 PM

Please check your firwall settings. You might need to enable the port on the server.

Feb 24, 2010 at 7:28 PM

Does the mex endpoint get created even if you add the "Turn Off Metadata Publishing" policy to the endpoint?  I read this article http://connect.microsoft.com/VisualStudio/feedback/details/286744/port-sharing-mextcpbinding-and-nettcpbinding-fails-when-maxconnections-or-listenbacklog-is-adjusted and it seems to describe the issue we are facing.  Whenever we attempt to change the maxConnections to any value other than 10 on the nettcpbinding for our service we receive the infamous "Failed to create listener for [net.tcp://endpoint] with reason [There is already a listener on IP endpoint 0.0.0.0:808.  Make sure that you are not trying to use this endpoint multiple times in your application and that there are no other applications listening on this endpoint.]" error.

Feb 25, 2010 at 8:54 PM

Unfortunately this does seem to be the case.  The mex tcp binding the MSE uses when enabling the mex endpoint doesn't enable port sharing, which results in the wcf error you are receiving. 

This is a bug with limited workaround since you can't disable the mex endpoint for tcp endpoints and the binding the MSE creates can't be overridden through policy.  The only workaround is to not modify the settings.

Feb 25, 2010 at 9:01 PM
Edited Feb 26, 2010 at 3:18 PM
botto wrote:

Unfortunately this does seem to be the case.  The mex tcp binding the MSE uses when enabling the mex endpoint doesn't enable port sharing, which results in the wcf error you are receiving. 

This is a bug with limited workaround since you can't disable the mex endpoint for tcp endpoints and the binding the MSE creates can't be overridden through policy.  The only workaround is to not modify the settings.

Will there be a fix for this in the next version?  We would really prefer to use Net.Tcp internally for our service, however, it is imperative that we can increase the maxConnections value.  Also, I've noticed that anytime you attempt to host a service through MSE you must disable the NetTcp port sharing service.  These are both serious limitations to the capabilities of MSE.  I realize we can increase the number of connections able to be queued up for the service, however, basically as it stands there cannot be more than 10 requests processed through a multi-threaded service concurrently regardless of the service's configuration.

Feb 26, 2010 at 12:32 AM

We've figured out a workaround that you can use to remove the mex endpoint that is automatically created by the MSE.  Create your own IServiceBehavior and use the following for the Validate method:

        public void Validate(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)
        {
            ServiceEndpoint endpoint = serviceDescription.Endpoints.FirstOrDefault(ep => ep.Name == "MetadataExchangeTcpBinding_IMetadataExchange");
            if (endpoint != null)
            {
                serviceDescription.Endpoints.Remove(endpoint);
                serviceDescription.Behaviors.Remove<ServiceMetadataBehavior>();
            }
        }

 

This will give you the flexibility to tune the nettcp binding as long as you don't also need the mex endpoint.

HTH.

Feb 26, 2010 at 3:20 PM
botto wrote:

We've figured out a workaround that you can use to remove the mex endpoint that is automatically created by the MSE.  Create your own IServiceBehavior and use the following for the Validate method:

        public void Validate(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)
        {
            ServiceEndpoint endpoint = serviceDescription.Endpoints.FirstOrDefault(ep => ep.Name == "MetadataExchangeTcpBinding_IMetadataExchange");
            if (endpoint != null)
            {
                serviceDescription.Endpoints.Remove(endpoint);
                serviceDescription.Behaviors.Remove<ServiceMetadataBehavior>();
            }
        }

 

This will give you the flexibility to tune the nettcp binding as long as you don't also need the mex endpoint.

HTH.

Sounds good!  I'll give it a try.  Thanks for looking into this!