暴露方法在WinForm的Web服务操作 [英] exposing methods as web service operations in winform

查看:186
本文介绍了暴露方法在WinForm的Web服务操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能暴露我的方法在一个WinForm和webMethods的还有其他客户打电话给他们的web服务?我Basicall我试图让我的winform应用程序来承载Web服务,而不asp.net或IIS。

can't I expose my methods as webmethods in a winform and have other clients call them as webservice? Basicall I am trying to get my winform app to host a webservice without asp.net or iis.

我想获得一个^%的&放大器; ^&安培; 的黑莓与我的winform应用程序通信....尝试了好几个小时寻找让两人交谈没有HTTP的一些其他的方式web服务。

I am trying to get a ^%&^& blackberry to communicate with my winform app....tried for hours looking for some other way of getting the two to talk without http webservice.

我一直在寻找,但UDP和放大器;的&放大器; 的BB不提供Web服务比其他Visual Studio开发的任何文件

I was looking at UDP but && BB does not provide any documentation for Visual Studio development other than webservice.

推荐答案

有一件事情很多人有一个问题,就是他们忘了,他们需要添加防火墙规则或前言端口允许端点外连接尝试时从使用运营商的网络连接(而不是无线)的手持式设备通信。它可以完全错过,因为黑莓是坐在你旁边,你不把它作为一个外线来电。

One thing many people have a problem with is they forget that they need to add a firewall rule or foreword a port to allow outside connection to the endpoint when trying to communicate from a hand-held device that is using the carrier's internet connection (rather than wifi). it could be completely missed since the blackberry is sitting right next to you and you don't think of it as an outside caller.

如果这不是这样尝试WCF托管应用程序

if that's not the case try a WCF hosted app

您可以使用WCF端点暴露你的服务。

You can expose your service using a WCF endpoint.

http://msdn.microsoft.com/en-us/library /ms731758.aspx

   // Host the service within this EXE console application.
    public static void Main()
    {
      // Create a ServiceHost for the CalculatorService type and use
      // the base address from config.
      ServiceHost hostDefault = new ServiceHost(typeof(CalculatorService));

      int manualFlowControlLimit =  hostDefault.ManualFlowControlLimit;


      basicHttpBinding portsharingBinding = new basicHttpBinding();
      hostDefault.AddServiceEndpoint(typeof( CalculatorService ),portsharingBinding,"http://localhost/MyService" );

      using (ServiceHost serviceHost = new ServiceHost(typeof(CalculatorService)))
      {
    			  // Open the ServiceHost to start listening for messages.
    	  serviceHost.Open();
    	  // The service can now be accessed.
    	  Console.WriteLine("The service is ready.");
    	  Console.WriteLine("Press <ENTER> to terminate service.");
    	  Console.ReadLine();

    	  // Close the ServiceHost.
    	  serviceHost.Close();
      }
    }

这篇关于暴露方法在WinForm的Web服务操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆