tags:

views:

3815

answers:

2
<system.serviceModel>
    <services>
      <service name="SUR.Core.Service.Implementation.SURDirectoryService" behaviorConfiguration="DefaultServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://127.0.0.1:8731/ISURDirectoryService"/>
          </baseAddresses>
        </host>
        <endpoint address=""  binding="netTcpBinding" bindingConfiguration="DefaultDirectoryServiceBindConfig" contract="SUR.Core.Service.Facade.ISURDirectoryService"/>
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
      </service>
      <service name="MSS.Core.Service.Implementation.MSSDirectoryService" behaviorConfiguration="DefaultServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://127.0.0.1:8731/IMSSDirectoryService"   />
            <add baseAddress="http://127.0.0.1:8732/IMSSDirectoryService"   />
          </baseAddresses>
        </host>
        <endpoint address=""  binding="netTcpBinding" bindingConfiguration="DefaultDirectoryServiceBindConfig" contract="MSS.Core.Service.Facade.IMSSDirectoryService"/>
        <endpoint address="Person" binding="basicHttpBinding" bindingConfiguration="StreamedServicesBinding" contract="MSS.Core.Service.Facade.IMSSPersonService"/>
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <bindings>
      <customBinding>
        <binding name="MetadataExchangeTcpBinding">
          <tcpTransport portSharingEnabled="True" />
        </binding>
      </customBinding>
      <netTcpBinding>
        <binding name="DefaultDirectoryServiceBindConfig" maxReceivedMessageSize="1048576"
             closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:05:00">
          <security mode="None"></security>
        </binding>
        <binding name="mexBinding" portSharingEnabled="true">
          <security mode="None"/>
        </binding>
      </netTcpBinding>
      <basicHttpBinding>
        <binding name="StreamedServicesBinding" transferMode="StreamedResponse" maxReceivedMessageSize="10067108864"
                 closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:05:00" maxBufferSize="500" >
          <security mode="None"></security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="DefaultServiceBehavior">
          <serviceMetadata />
          <dataContractSerializer maxItemsInObjectGraph="6553600" />
          <!-- To avoid disclosing metadata information, 
          set the value below to false and remove the metadata endpoint above before deployment -->
          <!--<serviceMetadata httpGetEnabled="True"/>-->
          <serviceThrottling maxConcurrentCalls="30" maxConcurrentSessions="30" maxConcurrentInstances="30"/>
          <!-- To receive exception details in faults for debugging purposes, 
          set the value below to true.  Set to false before deployment 
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="True" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

Here is my WCF configuratio but when i try to add service reference to
net.tcp://127.0.0.1:8731/IMSSDirectoryService
I get an error Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:8731/IMSSDirectoryService'. Metadata contains a reference that cannot be resolved: 'net.tcp://localhost:8731/IMSSDirectoryService'. If the service is defined in the current solution, try building the solution and adding the service reference again.
please help me to understand my problem

+2  A: 

You have two identical base addresses defined:

<service name="SUR.Core.Service.Implementation.SURDirectoryService" 
         behaviorConfiguration="DefaultServiceBehavior">
  <host>
    <baseAddresses>
      <add baseAddress="net.tcp://127.0.0.1:8731/ISURDirectoryService"/>
    </baseAddresses>


<service name="MSS.Core.Service.Implementation.MSSDirectoryService" 
         behaviorConfiguration="DefaultServiceBehavior">
   <host>
     <baseAddresses>
       <add baseAddress="net.tcp://127.0.0.1:8731/IMSSDirectoryService"   />

That is the cause of your problems - when connecting to net.tcp://127.0.0.1:8731/, WCF doesn't know which service you mean.

The base address must be UNIQUE within its "schema" (e.g. http, net.tcp etc.)

Marc

EDIT: if you want to be able to retrieve your metadata using the browser and navigating to a URL to get it, you'll need to activate the <serviceMetadata httpGetEnabled="True"/> in your service behavior option. Otherwise, you'll only be able to get at your metadata using a SOAP call over net.tcp - e.g. using the "WcfTestClient.exe" app which is in your Visual Studio 9/Common7/IDE folder.

EDIT 2: you have defined a number of extra bindings and behaviors for MEX, but since none of your mex endpoints is actually referencing any of those settings, they're not being used.

marc_s
I changed the port of ISURDirectoryService it doesn't help, I get the same error message
ArsenMkrt
How are you trying to get your metadata? Using some SOAP call, or are you trying in the browser?
marc_s
Browser returns bed request, svcutill tool generates proxy for SUR but in generating MSS i get error, The message with Action 'http://schemas.xmlsoap.org/ws/2004/09/transfer/Get' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g.Message, Transport, None).
ArsenMkrt
OK - for the browser to be able to see your metadata (which would be a great way to verify everything is ok), enable the serviceMetadata httpGetEnabled setting as I indicated.As for the error with the MSS service - this doesn't sound like a config problem. You'll need to check your SOAP actions and your contracts - something is inconsistent in them. Can you post the service contract definition for the MSS service?
marc_s
MSS Service contract is big, Is it possible that caouse a problem? I commented all function the wcfclienttest openes the service normally, than I start to open comments, and there is a point after wich, uncommenting even a simple contract method causes the error
ArsenMkrt
A: 

I solved the problem, I just change mex binding for MSS service to http. thanks a lot marc_s your response help me to understand the problem!

ArsenMkrt
Ah, excellent - glad you found the problem!
marc_s
I'm having the same problem. I don't want to use mexhttpBinding. I'd like to use mexTcpBinding. The Add Service reference dialog is throwing the error indicated in the post, any clues?
Abhijeet Patel