7
votes

how can I reference WCF to my .NET Core client? I download and install "WCF Service Preview" plugin but when I trying add reference I got error

Error: No endpoints compatible with .Net Core apps were found. An error occurred in the tool.

Failed to generate service reference.

enter image description here

When I try service in my browser, works fine. Any ideas ? My WCF's web config:

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

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
  </appSettings>

  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
    <httpModules>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"/>
    </httpModules>
  </system.web>

  <system.serviceModel>
    <services>
      <service name="ServiceLayer.TeamManagementService" behaviorConfiguration="GetDataBehavior">
        <endpoint address="" binding="webHttpBinding" contract="ServiceLayer.ITeamManagementService" behaviorConfiguration="GetDataEndpointBehavior"></endpoint>
      </service>
    </services>

    <behaviors>

      <serviceBehaviors>
        <behavior name="GetDataBehavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>

      <endpointBehaviors>
        <behavior name="GetDataEndpointBehavior">
          <webHttp/>
        </behavior>
      </endpointBehaviors>

    </behaviors>

    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https"/>
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="ApplicationInsightsWebTracking"/>
      <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web"
        preCondition="managedHandler"/>
    </modules>
    <directoryBrowse enabled="true"/>
    <validation validateIntegratedModeConfiguration="false"/>
  </system.webServer>

</configuration>
2
Microsoft has moved all its focus to Visual Studio 2017 RC for .NET Core. You should try to generate a reference via that instead of working in VS2015, which is abandoned.Lex Li
You can find the solution here: stackoverflow.com/a/39895385/1520221Ruthi
Are you trying to host a service in WCF in .net core? Or are you trying to consume a WCF service from .net core code?tom redfern

2 Answers

2
votes

Uncheck Reuse types in referenced assemblies.

0
votes

I faced a similar problem a couple of days ago and could not find a specific reason to why the endpoint was not recognized correctly by the extension. I solved this by creating a class library project that includes a proxy for the actual WCF service. The NET Core project can then reference this project and indirectly call the service without connected references.

If you haven't found a solution to the problem yet, have a look at my github repository to see an example: https://github.com/jolmari/netcore-wcf-service-proxy