3

I am working on a WCF service which runs along with ASP.NET MVC 2 application with https port which have been configured using webMatrix-ssl certificate. The service is running perfectly in the browser and could download wsdl as well. But when am trying to load the service into wcftestclient tool and as well as my own client, getting the below error.

Error: Cannot obtain Metadata from 'localhost:44300/MyService' 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 go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error    URI: localhost:44300/MyService    Metadata contains a reference that cannot be resolved: 'localhost:44300/MyService'.    The remote server returned an unexpected response: (302) Found.    Too many automatic redirections were attempted.HTTP GET Error    URI: localhost:44300/MyService    There was an error downloading 'localhost:44300/MyService'.    The request failed with the error message:--"

I had added the attribute aspNetCompatibilityEnabled="true" for wcf service routing, if that attribute has been removed all works fine. Initially this service has been configured with basicHttpBinding & had this same issue. After reading this article, I have changed to wshttpBinding as suspected binding could also be the problem, still am getting the same issue, below is my web.config.

Could anyone of you please help me to repair this?

<system.serviceModel>    
    <extensions>
      <behaviorExtensions>
        <add name="ExceptionBehavior" type="ServiceExceptionHander.ExceptionHandlerBehaviorExtension, ServiceExceptionHandler" />
      </behaviorExtensions>
    </extensions>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true" />
          <ExceptionBehavior />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="ServiceImplementation.MyService" behaviorConfiguration="ServiceBehavior">
        <endpoint binding="wsHttpBinding" bindingConfiguration="securityBinding" contract="ServiceContracts.IMyServiceContracts"/>    
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>    
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="securityBinding">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>          
        </binding>
      </wsHttpBinding>   
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true">
      <serviceActivations>
        <add factory="System.ServiceModel.Activation.ServiceHostFactory" service="ServiceImplementation.MyService" relativeAddress="MyService.svc"/>
      </serviceActivations>
    </serviceHostingEnvironment>    
</system.serviceModel>
Murugan Durai
  • 143
  • 3
  • 12
  • It looks like your quotes are wrong on your mex endpoint - copied out of Word maybe? Either way, try replacing them with regular quotes like you have elsewhere in your config. – zimdanen Dec 19 '12 at 18:59
  • Hi zimdanen, thanks i have changed and tested it, still getting the same issue. – Murugan Durai Dec 20 '12 at 10:35

0 Answers0