0

Error

Error: Cannot obtain Metadata from localhost:81/WebServices/Legacy.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: localhost:81/WebServices/Legacy.svc Metadata contains a reference that cannot be resolved: 'localhost:81/WebServices/Legacy.svc'.

My Web.Config

<system.serviceModel>
    <services>
        <service name="Web.WebServices.Legacy" behaviorConfiguration="serviceBehaviorsZero">
          <endpoint address=""
                      name="SspService"
                      binding="basicHttpBinding"
                      bindingConfiguration="basicHttpBindingZero"
                      contract="Web.WebServices.ILegacy" />

          <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
        </service>
    </services>
    <bindings>
        <basicHttpBinding>
            <binding name="basicHttpBindingZero">
                <security mode="None">
                </security>
            </binding>
        </basicHttpBinding>

    </bindings>
    <behaviors>
        <serviceBehaviors>
            <behavior name="serviceBehaviorsZero">
                <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>

Why I not able to access my webservices using WCF Test Client?

When I acess via URL localhost:81/WebServices/Legacy.svc in browser I get this error The filename, directory name, or volume label syntax is incorrect.

Update: My .svc file code

<%@ ServiceHost Language="C#" Debug="true" Service="Web.WebServices.Legacy" CodeBehind="Legacy.svc.cs" %>

[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)]
    public class Legacy : ILegacy
    {
        public string DoWork()
        {
            return "https";
        }
    }
Mohsin JK
  • 561
  • 2
  • 8
  • 18
  • can you show the contents of the .svc file please? – Chris Dec 19 '13 at 15:52
  • You have `mexHttpsBinding` - possibly change this to `mexHttpBinding`, or change test client to point to a local HTTPS endpoint? – StuartLC Dec 19 '13 at 15:57
  • @Chris: Markup: <%@ ServiceHost Language="C#" Debug="true" Service="MvcApplication4.WS.Service1" CodeBehind="Service1.svc.cs" %> C# Code: namespace Web.WebServices { [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)] public class Legacy: ILegacy { public string DoWork() { return "OK"; } } } – Mohsin JK Dec 20 '13 at 09:47

1 Answers1

0
  1. Put just simple file on the web site directory (hello.html), and check if it is reachable (helloworld.html)

    Hello World Hello World!!!

If not working - check your binding settings on IIS, and whether the service and it's application pool is on.

  1. On IIS configuration, choose 'features view', and go to 'directory browsing' + enable.
  2. At the end of the svc put : ...svc?wsdl
  3. First check on your own local environment. After everything fine, you can check from the web.
  4. On Visual Studio, you shall do the basic by creating new web site (new folder), and copy result to the web site (including web.config) - there is a default source code. you can add new function to service (i.e helloworld, which returns a string, and refer it on iservices). If svc file is not created (old VS versions) - you can create text file of your own, and do some copy+paste to fix the svc file ... on web site, there shall be app_code and app_data folders.

Hope that help. Good luck!!!

Eitan
  • 1,286
  • 2
  • 16
  • 55