简体   繁体   English

从同一网络上的另一台PC测试WCF Web服务

[英]Test a wcf webservice from another PC on the same network

I have created a simple wcf webservice on visual studio 2010. 我已经在Visual Studio 2010上创建了一个简单的WCF Web服务。

I run it on ASP.NET development server. 我在ASP.NET开发服务器上运行它。

I try to call a simple GET service local on a browser using the local url: 我尝试使用本地URL在浏览器上调用本地的简单GET服务:

http://localhost:15021/MyService.svc/getData/test

That works and I get a correct JSON result. 那行得通,我得到了正确的JSON结果。 I also tried on fiddler and its working. 我还尝试了提琴手及其工作。

I would like to call it from another computer connected on the same network. 我想从连接在同一网络上的另一台计算机上调用它。

I got my local IPV4 from cmd and tried to replace the localhost with it on the other PC 我从cmd获取了本地IPV4,并尝试在另一台PC上用它替换localhost

http://10.0.0.14:15021/MyService.svc/getData/test

However I am getting an error 502: Connection failed 但是我收到error 502: Connection failed

How can I call the services that I run on ASP.NET development server from another PC/Mobile on the same network? 如何从同一网络上的另一台PC / Mobile调用在ASP.NET开发服务器上运行的服务?

thanks 谢谢

Just deploy and host it in IIS. 只需将其部署并托管在IIS中即可。 Then you will get internal IP address as you are saying it is on under same network. 然后,您将获得内部IP地址,就像您说的是在同一网络下一样。 Just test it with that local system's browseer where it is hosting at that moment and then check from another PC which is also under same network. 只需使用当时托管该本地系统的浏览器对其进行测试,然后从同样位于同一网络下的另一台PC进行检查。

Same thing happened to me. 同样的事情发生在我身上。 The problem is iis express, it doesnt allow your website to be accessible from other machine on the same network. 问题是iis express,它不允许您从同一网络上的其他计算机访问您的网站。 Visual studio by deault uses iis express. Deault的Visual Studio使用iis Express。 So you wont be able to access it , when using iis express. 因此,使用iis express时,您将无法访问它。 So what to do? 那么该怎么办?

Install latest IIS or try enabling the already installed iis using Control Panel> Programs > Turn Windows features On or OFF > Internet Information Services 安装最新的IIS,或尝试使用“控制面板”>“程序”>“打开或关闭Windows功能”>“ Internet信息服务”启用已安装的iis。

After installing/enabling you can start iis by typing inetmgr in command prompt. 安装/启用后,可以通过在命令提示符下键入inetmgr来启动iis。 Once IIS is up and running you can use this tutorial to upload your website: IIS启动并运行后,您可以使用本教程上传您的网站:

Tutorial to host on IIS 在IIS上托管的教程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM