.NET Core中的WCF参考

编程入门 行业动态 更新时间:2024-10-25 04:16:01
本文介绍了.NET Core中的WCF参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何将WCF引用到.NET Core客户端?我下载并安装了 WCF Service Preview插件,但是当我尝试添加引用时出现错误

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

错误:没有与.Net Core兼容的端点找到了应用程序。 工具发生错误。

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

无法生成服务引用。

当我尝试在浏览器中进行服务时,效果很好。有任何想法吗 ? 我的WCF的网络配置:

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>

推荐答案

几天前我遇到了类似的问题,无法找到扩展无法正确识别端点的特定原因。我通过创建一个包含实际WCF服务代理的类库项目解决了这一问题。然后,NET Core项目可以引用该项目,并在没有连接引用的情况下间接调用该服务。

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.

如果尚未找到解决问题的方法,请查看我的github存储库中查看示例: github/ jolmari / netcore-wcf-service-proxy

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

更多推荐

.NET Core中的WCF参考

本文发布于:2023-11-03 14:46:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555398.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NET   Core   WCF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!