WCF 服务参考在其他 PC 上不起作用

编程入门 行业动态 更新时间:2024-10-27 02:19:11
本文介绍了WCF 服务参考在其他 PC 上不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个 Windows 应用商店 - Metro 应用程序,该应用程序与运行在同一台 PC(托管在控制台应用程序中)但在 Windows 8 的桌面模式上的 Net TCP WCF 服务连接.我在 Metro 应用程序中添加了 WCF 服务的引用和一切正常.

I have a Windows Store - Metro app that connects with a Net TCP WCF Service running on same PC (hosted in a console application) but on Desktop mode of Windows 8. I have added a reference of WCF Service inside metro app and everything works fine.

我打包了我的商店/地铁应用程序和 WCF 服务,并在另一台没有安装 Visual Studio 的 PC 上试用,所以我不重新编译代码,我只安装了地铁应用程序包并运行 WCF 服务的可执行文件.WCF 服务启动正常,但是当我启动我的 Metro 应用程序时它给了我错误(见下图)

I package my store/metro app and WCF Service and try out on another PC which don't have Visual Studio installed so I don't recompile the code, I just install the metro app package and run the executable of WCF Service. WCF Service starts fine but when I launch my metro app it give me error (see the image below)

似乎由于某种原因,安装在其他 PC 上的 Metro 应用程序无法找到服务参考.谷歌搜索后我尝试了很多东西,但没有任何效果.任何想法/提示/建议将不胜感激.

It seems that for some reason metro app when installed on other PC is unable to find the service reference. I have tried many things after googling but nothing works. Any ideas/hint/suggestion would be greatly appreciated.

推荐答案

Windows 应用商店应用程序一般不能使用环回地址,除非 1) SAME 进程内的通信,或 2) 用于开发目的.来自如何启用环回和排除网络隔离故障:

Windows Store Apps generally cannot use the loopback address, except for 1) communication within the SAME process, or 2) for development purposes. From How to enable loopback and troubleshoot network isolation:

使用 IP 环回地址的网络通信不能用于 Windows 应用商店应用中的进程间通信(两个不同应用之间),因为这受到网络隔离的限制.出于通信目的,允许在同一进程内的应用内使用 IP 环回地址进行网络通信.

Network communications using an IP loopback address cannot be used for interprocess communication (between two different apps) in a Windows Store app since this is restricted by network isolation. Network communication using an IP loopback address is allowed within an app within the same process for communication purposes.

开发人员可能希望将环回用于测试或调试目的,即使客户无法使用该功能.例如,应用程序可能希望从 Windows 应用商店应用程序的 Web 服务下载数据.出于开发目的,开发人员希望在单台计算机上测试应用程序,该计算机在 127.0.0.1 上本地配置了 Web 服务.

A developer may want to use loopback for testing or debugging purposes, even though that capability will not be available for customers. For example, an app may want to download data from a web service from a Windows Store app. For development purposes, the developer wants to test the app on a single computer that is configured with the web service locally on 127.0.0.1.

Loopback 仅允许用于开发目的.不允许在 Visual Studio 之外安装的 Windows 应用商店应用使用.

Loopback is permitted only for development purposes. Usage by a Windows Store app installed outside of Visual Studio is not permitted.

在生产场景中,您可能必须在单独的计算机上安装 WCF 服务.请注意,您必须启用专用网络".您的应用程序清单(在客户端应用程序上)中启用本地网络访问的功能.

In a production scenario, you will likely have to install the WCF service on a separate machine. Note that you will have to enable the "private network" capability in your application manifest (on the client app) to enable local network access.

更多推荐

WCF 服务参考在其他 PC 上不起作用

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

发布评论

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

>www.elefans.com

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