0
votes

Development Environment:

Services are hosted under IIS/WAS

I have four services developed on my local development. All four of them are working fine when I am accessing them from asp.net application. I am using net.tcp protocol to connect. I have specified net.tcp as allowed protocol at site level and at virtual directory level. All three services related to tcp are started.

In application web.config from which I am able to connect to services, I am using impersonation

But when I try to connect to the services by specifying net.tcp url in the Add service project of wcftestclient. I am not able to connect. With same configuration for two other services, I am able to connect to those two other services.

Test Server: I even deployed on a Test Server. Even there I am facing same issue. I can connect to same two services using net.tcp url. But other two gives error. One of which's config is listed below. on Server I even removed allowed users part to make it run for all users.

Error I am getting is as follows.

Error: Cannot obtain Metadata from net.tcp://localhost/servicesdev/SalesPersonService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: net.tcp://localhost/servicesdev/SalesPersonService.svc Metadata contains a reference that cannot be resolved: 'net.tcp://localhost/servicesdev/SalesPersonService.svc'. The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:05:00'. An existing connection was forcibly closed by the remote host

Following is config section.

 <services>
   <service behaviorConfiguration="ServiceBehavior" name="WCFServiceLibrary.SalesPersonService">
        <endpoint address="" binding="wsHttpBinding" contract="WCFServiceLibrary.ISalesPersonService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
        <endpoint address="basic" binding="basicHttpBinding" contract="WCFServiceLibrary.ISalesPersonService" />
        <endpoint address="net.tcp://localhost/servicesdev/SalesPersonService.svc" binding="netTcpBinding" contract="WCFServiceLibrary.ISalesPersonService" listenUriMode="Explicit" />
      </service>
  </services>

<behaviors>
       <serviceBehaviors>
          <behavior name="ServiceBehavior">
           <serviceMetadata httpGetEnabled="true" />
           <serviceDebug includeExceptionDetailInFaults="false" />
          </behavior>
      </serviceBehaviors>
  </behaviors>


<system.web>
    <compilation targetFramework="4.0" debug="true" />
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
        <identity impersonate="true" />
        <authorization>
            <allow users="myuser" />
        </authorization>
  </system.web>

Thanks, BMP

1

1 Answers

0
votes

You are specifying a relative address for mex, without giving a base address. Try giving a base address as shown in example below. the relative address for mex should work then

           <host>
              <baseAddresses>
               <add baseAddress="net.tcp://localhost/servicesdev/SalesPersonService.svc"/>
              </baseAddresses>
            </host>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <endpoint address="" binding="wsHttpBinding" contract="WcfServiceLibrary1.ISalesPersonService" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
            <endpoint address="basic" binding="basicHttpBinding" contract="WcfServiceLibrary1.ISalesPersonService" />
            <endpoint address="" binding="netTcpBinding" contract="WcfServiceLibrary1.ISalesPersonService" />