c# – .NET Core中的WCF引用
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了c# – .NET Core中的WCF引用,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2276字,纯文字阅读大概需要4分钟。
内容图文
![c# – .NET Core中的WCF引用](/upload/InfoBanner/zyjiaocheng/767/b91fc748045643f1807d1012d058deec.jpg)
如何将WCF引用到我的.NET Core客户端?我下载并安装“WCF Service Preview”插件,但是当我尝试添加引用时,我收到了错误
Error: No endpoints compatible with .Net Core apps were found.
An error occurred in the tool.Failed to generate service reference.
当我在浏览器中尝试服务时,工作正常.有任何想法吗 ?
我的WCF的网络配置:
<?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项目可以引用此项目并间接调用没有连接引用的服务.
如果您还没有找到问题的解决方案,请查看我的github存储库以查看示例:
https://github.com/jolmari/netcore-wcf-service-proxy
内容总结
以上是互联网集市为您收集整理的c# – .NET Core中的WCF引用全部内容,希望文章能够帮你解决c# – .NET Core中的WCF引用所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。