远程创建Rest Web方法 [英] Create Rest Web Method remotely
本文介绍了远程创建Rest Web方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用以下代码,我在本地PC上创建一个REST Web方法并从浏览器中调用它:
With the following code I create a REST web method on my local pc and call it from browser:
public void RestService()
{
WebServiceHost host = new WebServiceHost(typeof(Service), new Uri(string.Format("http://{0}:8000",_ipAdresse)));
ServiceEndpoint ep = host.AddServiceEndpoint(typeof(IService), new WebHttpBinding(), "");
ServiceDebugBehavior stp = host.Description.Behaviors.Find<ServiceDebugBehavior>();
stp.HttpHelpPageEnabled = false;
host.Open();
}
是否可以在远程客户端上创建相同的方法,知道客户端的ipAdress?
Is it possible to create the same method on a remote client, knowing the ipAdress of the client?
推荐答案
客户端不承载该服务。您可以执行您正在执行的操作,因为您的计算机是本地客户端和服务器。
A client doesn't host the service. You are able to do what you are doing, because your machine is the client and the server, locally.
这篇关于远程创建Rest Web方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文