none
WCF Error : Cannot obtain Metadata from WCF service RRS feed

  • Question

  • Hi

    I just created a basic WCF Service Application (c#) using VS 2008 which contains .cs,.svc files. I compiled and deployed into IIS 7 using the Project Properties dialog-->WEB-->User Local IIS as webserver , Virtual directory got created automatically.

    I have not changed anything in the code / config files.

    The service is working fine in the browser and WCF test client in my local machine where I have local admin rights.

    But If I try to access the same service from another machine either thru browser or WCF Test client I am getting the following error.

    Error: Cannot obtain Metadata from http://xxxxxxx/WcfService1/Service1.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.

    I remotely logged on to the other machine then tried to add the service into the WCF Test Client using IP address of my local machine then tried with my machine name with full domain details but no luck.

    I goggled and tried the following suggestions but nothing helped me

    - removed the identity tag <identity> <dns value="localhost" /> </identity>

    - checked the endpoint for "mex"

    - endpoint behaviour has <serviceMetadata httpGetEnabled="true" />

    - with or without base address in the config file

    - enabled Windows /Anonymous authentication in IIS7

    Can anyone help me here?

    The config file contains ...

    <system.serviceModel>

     <services>

    <service name="WcfService1.Service1" behaviorConfiguration="WcfService1.Service1Behavior">

       <endpoint address="" binding="wsHttpBinding" contract="WcfService1.IService1">

       </endpoint>

       <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />

       <host>

         <baseAddresses>

           <add baseAddress="http://xxxxxx/WcfService1/Service1.svc" />

         </baseAddresses>

       </host>

      </service>

     </services>

    <behaviors>

      <serviceBehaviors>

       <behavior name="WcfService1.Service1Behavior">

         <serviceMetadata httpGetEnabled="true" />

            <serviceDebug includeExceptionDetailInFaults="false" />

       </behavior>

      </serviceBehaviors>

    </behaviors>

    </system.serviceModel>

    Regards

    MSK.

    Tuesday, February 12, 2013 3:13 PM

Answers

  • Hi,

    To check if you have published the service on IIS properly and IIS is configured properly, please try view the service in browser in IIS. And please make sure you have input the correct IP address of the machine( the service located) in brower(on another machine) when try to browse the service with http://ipaddress/WcfService1/Service1.svc.

    If it does not work, are the two machines in same domain? If they are in different domain, you need a Crossdomain.xml or clientaccesspolicy.xml at the root of the domain where the service is hosted.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 13, 2013 9:50 AM
    Moderator
  • Hi

    My desktop engineer did some magic ..reconfigured IIS7, ASP.NET and some user permissions for Network service,IUSR now it looks ok. The wcf can be accessed from other machines too.

    Thanks for your help

    Regards

    MSK

    • Marked as answer by mgsk Friday, February 15, 2013 3:35 PM
    Friday, February 15, 2013 3:35 PM

All replies

  • Hi mgsk,

    Can you please check from your remote machine that the following URL ( as mentioned in your write-up ) can be accessed. [ http://xxxxxxx/WcfService1/Service1.svc ] from your browser.

    Also make sure the service is running where it is hosted.

    Thanks,

    BR,

    JollyWagoner

    Tuesday, February 12, 2013 4:25 PM
  • No, I am getting "Internet explorer can not display the webpage" because of this only I tried to add that service to WCF test client to get more meaningful error message.

    I tried to access http://machinename or http://machinename.domainname.local/ or http://ipaddress/

    but the same result. Service is running fine in my local machine since its in IIS



    • Edited by mgsk Tuesday, February 12, 2013 4:36 PM
    Tuesday, February 12, 2013 4:35 PM
  • Hi,

    To check if you have published the service on IIS properly and IIS is configured properly, please try view the service in browser in IIS. And please make sure you have input the correct IP address of the machine( the service located) in brower(on another machine) when try to browse the service with http://ipaddress/WcfService1/Service1.svc.

    If it does not work, are the two machines in same domain? If they are in different domain, you need a Crossdomain.xml or clientaccesspolicy.xml at the root of the domain where the service is hosted.

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 13, 2013 9:50 AM
    Moderator
  • Thanks Haixia

    I am sure that I have published the service on IIS properly, because I did this thru VS 2008-->Project Properties dialog-->WEB-->User Local IIS as webserver , Virtual directory got created automatically.

    also the service is running fine on my local machine, I can see the wsdl details through the browser in my machine/ can add into WCF Test Client from my local machine / can add as Service reference to another project in my local machine.

    the another machine which I connected thru remotely (mstsc) is on the same domain.

    I can confirm that the machine name/IP address are correct.

    but one thing I noticed, the another machine is Windows Server 2003, Does it make any difference?

    any suggestions would be helpful..

    Regards

    MSK



    • Edited by mgsk Wednesday, February 13, 2013 12:32 PM
    Wednesday, February 13, 2013 12:19 PM
  • Hi,

    Select Local IIS Web server option is just to specify the Web Server for Web Projects in Visual Studio as IIS, not publish the service. Please take a look at the document below to publish your service to IIS.

    #WCF Service Publishing

    http://msdn.microsoft.com/en-us/library/bb924407.aspx

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, February 14, 2013 4:54 AM
    Moderator
  • Hi

    I published as per the instruction (mentioned the link you provided) ,but no luck, The service looks ok locally.

    Regars

    MSK.

    Thursday, February 14, 2013 5:17 PM
  • Hi,

    After publish the service, can you browse the service? If you cannot browse to the site, it may because directory browser is not enabled in IIS. Or can you directly type“http://localhost/WebApplicationFolderName/ProjectName.ServiceName.svc” to view your service page?

    Best Regards.


    Haixia
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, February 15, 2013 2:26 AM
    Moderator
  • Hi

    My desktop engineer did some magic ..reconfigured IIS7, ASP.NET and some user permissions for Network service,IUSR now it looks ok. The wcf can be accessed from other machines too.

    Thanks for your help

    Regards

    MSK

    • Marked as answer by mgsk Friday, February 15, 2013 3:35 PM
    Friday, February 15, 2013 3:35 PM