locked
Error: Cannot obtain Metadata RRS feed

  • Question

  • After deleting service references and moving them around, I broke my app.config, but I am not sure how.  If I remove the msmq endpoint and baseaddress, things work fine.  Otherwise, I get the following error.  I know this should be clue enough, but my mind is mush at this point.

    Error: Cannot obtain Metadata from http://localhost:10731/LoggingService/mex

    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: http://localhost:10731/LoggingService/mex

        Metadata contains a reference that cannot be resolved: 'http://localhost:10731/LoggingService/mex'.

        Could not connect to http://localhost:10731/LoggingService/mex. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:10731.

        Unable to connect to the remote server

        No connection could be made because the target machine actively refused it 127.0.0.1:10731

    HTTP GET Error
        URI: http://localhost:10731/LoggingService/mex

        There was an error downloading 'http://localhost:10731/LoggingService/mex'.

        Unable to connect to the remote server

        No connection could be made because the target machine actively refused it 127.0.0.1:10731

    App.config
    Code Snippet

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <configSections>
        <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
          <section name="CFTC.ServiceLibrary.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
        </sectionGroup>
      </configSections>
      <connectionStrings>
        <add name="CFTC.ServiceLibrary.Properties.Settings.SubscriptionServiceConnectionString"
          connectionString="Data Source=dbrust;Initial Catalog=SubscriptionService;Integrated Security=True"
          providerName="System.Data.SqlClient" />
        <add name="CFTC.ServiceLibrary.Properties.Settings.LoggingServiceConnectionString"
          connectionString="Data Source=dbrust;Initial Catalog=LoggingService;Integrated Security=True"
          providerName="System.Data.SqlClient" />
      </connectionStrings>
      <system.web>
        <compilation debug="true" />
      </system.web>
      <!-- When deploying the service library project, the content of the config file must be added to the host's
      app.config file. System.Configuration does not support config files for libraries. -->
      <system.serviceModel>
        <client />
        <services>
          <service behaviorConfiguration="CFTC.ServiceLibrary.PersistentSubscriptionService.SubscriptionServiceBehavior"
            name="CFTC.ServiceLibrary.PersistentSubscriptionService.SubscriptionService">
            <endpoint address="" binding="wsDualHttpBinding" contract="CFTC.ServiceLibrary.PersistentSubscriptionService.ISubscriptionService" />
            <endpoint address="" binding="netTcpBinding" bindingConfiguration="ReliableTcp"
              contract="CFTC.ServiceLibrary.PersistentSubscriptionService.ISubscriptionService" />
            <endpoint address="" binding="netNamedPipeBinding" contract="CFTC.ServiceLibrary.PersistentSubscriptionService.ISubscriptionService" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
            <endpoint address="mex" binding="mexNamedPipeBinding" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:8531/PersistentSubscriptionService/" />
                <add baseAddress="net.tcp://localhost:8532/PersistentSubscriptionService/" />
                <add baseAddress="net.pipe://localhost/PersistentSubscriptionService/" />
              </baseAddresses>
            </host>
          </service>
          <service behaviorConfiguration="CFTC.ServiceLibrary.Logger.LoggingSubscriptionBehavior"
            name="CFTC.ServiceLibrary.Logger.LoggingService">
            <!--
            -->
            <endpoint address="" binding="netMsmqBinding" contract="CFTC.ServiceLibrary.Logger.ILoggingService" />
            <endpoint address="" binding="wsDualHttpBinding" contract="CFTC.ServiceLibrary.Logger.ILogSubscriptionService" />
            <endpoint address="" binding="netTcpBinding" contract="CFTC.ServiceLibrary.Logger.ILogSubscriptionService" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:10731/LoggingService" />
                <add baseAddress="net.tcp://localhost:10732/LoggingService" />
                <add baseAddress="net.msmq://localhost/private/LoggerQueue" />
                <!--
                -->
              </baseAddresses>
            </host>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="CFTC.ServiceLibrary.PersistentSubscriptionService.SubscriptionServiceBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
            <behavior name="CFTC.ServiceLibrary.Logger.LoggingSubscriptionBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <bindings>
          <netTcpBinding>
            <binding name="ReliableTransactionalTcp" transactionFlow="true">
              <reliableSession enabled="true" />
            </binding>
            <binding name="ReliableTcp">
              <reliableSession enabled="true" />
            </binding>
          </netTcpBinding>
        </bindings>
      </system.serviceModel>
      <applicationSettings>
        <CFTC.ServiceLibrary.Properties.Settings>
          <setting name="LoggerQueueName" serializeAs="String">
            <value>.\private$\LoggerQueue</value>
          </setting>
        </CFTC.ServiceLibrary.Properties.Settings>
      </applicationSettings>
    </configuration>


    Tuesday, June 3, 2008 1:15 AM

Answers

  • Well, I'm not entirely sure how it happened, but it seems there was some sort of problem with my msmq queue.  I created a new private transactional queue, changed the app.config file to use this queue, and it started back up.  In hind sight I should have tried this earlier, but I just didn't think that could be the problem.


    Thanks for everyone who looked at this problem.


    Darren

     

    Tuesday, June 3, 2008 1:56 PM

All replies

  • Hi dbrust,

     1) Is your service currently running @ http://localhost:10731/LoggingService ? If not, you have to start it, so the metadata can be retrieved from the mex endpoint.

     2) If it is running, is there an available MetaExchange endpoint?

     You have to have something like <endpoint adress="mex" contract="IMetadataExchange" />  in your service configuration + the <serviceMetadata /> added to your configured service behavior.

     Good luck,

      --larsw
    Tuesday, June 3, 2008 7:55 AM
  • Hi Lars,

     

    I am debugging this with the WCFServiceHost, so it won't even start properly because of this problem.  I get the error message when the service host tries to start up.  It worked before, not sure what I blew away.


    As to your second question, there is a mex endpoint listed in the configutation above under the LoggingSystemBehavior BehaviorConfiguration.


    Thanks,
    Darren

     

    Tuesday, June 3, 2008 10:17 AM
  • Are these errors coming from the client?  They look like client errors, but I would expect this if your service cant start.  Is there some other error that the service is showing that is causing it not to start? 

     

    It might to do with the msmq binding.  Does it work if you just remove this?  Does it work if you just remove the base addresses?  Does it work if you remove the mexHttpBinding and just try to hit the metadata at ?wsdl?

     

    Tuesday, June 3, 2008 11:55 AM
  • Hi Dan,


    Sorry, had more information in the post last night, but 3 times that I hit the "Post" button, it simply cleared everything I did, so it became shorter and shorter.


    This error occurs when the service cannot start, debugging through VSTS with the WCFServiceHost.  You'll notice that there are in fact two services in the app.config file.  The first starts fine, and the second did until I deleted service references and moved them.  Upon moving them back, everything was borked.

     

    I thought I had mentioned above that removing the msmq binding and endpoint allows the service to start, so the problem is associated with the msmq binding.  I removed the mexHttpBinding, and still had the same problem, only now with wsdl instead of mex.

     

    I had two contracts hosted on the same service, one with the msmq binding, and the other with tcp & named pipe bindings working fine.  I cannot figure out what causes the computer to "Activly refuse" the connection for the mex data when just adding the msmq endpoint now!

     

    Thanks,
    Darren

     

    Tuesday, June 3, 2008 12:23 PM
  • Well, I'm not entirely sure how it happened, but it seems there was some sort of problem with my msmq queue.  I created a new private transactional queue, changed the app.config file to use this queue, and it started back up.  In hind sight I should have tried this earlier, but I just didn't think that could be the problem.


    Thanks for everyone who looked at this problem.


    Darren

     

    Tuesday, June 3, 2008 1:56 PM