0

I'm using Visual Studio for a school project and I'm to create a simple WCF Service Application web service that I need to test using WCF Test Client.

I developed the service, but then when I run the debugger, it opens a web browser, I copy the link to the IService1.svc file, and try to add that to the test client, and it fails complaining it cannot get meta data.

I tried this on a fresh solution with a new project, and same thing.

My Web.config file:

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.8.1" />
    <httpRuntime targetFramework="4.8.1"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <!-- 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="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>

Am I missing any steps in testing the web services?

joepaji
  • 45
  • 4

1 Answers1

0

Depending on your wcf configuration file, you can see the parts without endpoints and service contracts. You may have missed the <service.model> section:

<services> 
<service name="Namespace.Service1"> 
<endpoint address="" binding="basicHttpBinding" contract="Namespace.IService1" /> 
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
</service> 
</services>
Jiayao
  • 510
  • 3
  • 7