(转)添加服务引用和添加Web引用对比
在WindowsForm程序中添加服务引用和Web引用对比
为了验证书上有关Visual Studio 2010添加服务引用和Web引用的区别,进行实验。
一、建立一个Web服务程序项目
新建项目,选择ASP.NET空Web应用程序,在其中添加Web服务,然后发布到IIS,路径为http://localhost/hello/hello.asmx,服务主要通过HelloWorld()方法输出字符串“Hello World”,内容如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
namespace Hello
{
/// <summary>
/// Hello 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
// [System.Web.Script.Services.ScriptService]
public class Hello : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
二、建立测试程序
窗体应用程序,在项目中选择添加服务引用,选择高级,添加Web引用来使用,引用后可以看到在Service References文件夹下出现的ServiceReferrence1中有:configuration.svcinfo,configuration91.svcinfo,hello.disco,hello.wsdl,Reference.cs,Reference.svcmap,共六个文件,或者直接添加服务引用。要使用的泪和方法在下图:

在Web项目和Web网站解决方案引用时可以选择添加Web引用还是服务引用。
1.添加Web引用,选择命名空间为localhost,在App_WebReferences文件夹下出现引用信息,localhost文件夹下有如下文件:Hello.disco,Hello.discomap,Hello.wsdl。
2.添加服务引用,命名空间为local1,local1文件夹中有以下文件:configuration.svcinfo,configuration91.svcinfo,hello.disco,Hello.wsdl,Reference.svcmap。
效果如下

(转)添加服务引用和添加Web引用对比的更多相关文章
- 添加web引用和添加服务引用有什么区别?
添加web引用和添加服务引用有什么区别,Add Service References 和 Add Web References 有啥区别?参考 http://social.microsoft.com/ ...
- (转)2.4.1 基础知识--添加服务引用与Web引用的区别
<Web服务开发学习实录>第2章构建ASP.NET Web服务,本章我们将学习创建Web服务的各种方法,并重点对使用Visual Studio创建ASP.NET Web服务和修改Web服务 ...
- 关于WCF的引用,添加服务和添加web服务的区别
原文:关于WCF的引用,添加服务和添加web服务的区别 本章内容主要是根据我做的实验来阐述这2种添加服务针对WCF的不同之处,我们按照示例一步一步来看. 如下是工程的结构: 该WCF服务是通过控制台程 ...
- 添加服务引用和添加Web引用对比
原文:添加服务引用和添加Web引用对比 在WindowsForm程序中添加服务引用和Web引用对比 为了验证书上有关Visual Studio 2010添加服务引用和Web引用的区别,进行实验. 一. ...
- VS中,添加完Web引用(WebServer引用/Web服务引用),写代码时引用不到
VS中,添加完Web引用(WebServer引用/Web服务引用),写代码时引用不到 添加完之后要等一会儿 等一会儿 等一会儿 就有了
- .net 添加web引用和添加服务引用有什么区别?
添加web引用和添加服务引用有什么区别, Add Service References 和 Add Web References 有啥区别? 参考 http://social.microsoft.co ...
- WebService-.Net:添加web引用和添加服务引用有什么区别?
ylbtech-WebService-.Net:添加web引用和添加服务引用有什么区别? 1.返回顶部 1. 添加web引用和添加服务引用有什么区别,Add Service References 和 ...
- [问题]通过IIS宿主发布WCF服务,客户端添加服务引用出错的解决办法
环境配置:Web服务器:Windows Server 2008,iis7.5,.net4.0客户端:XPsp3 vs2010 sp1 问题描述:1.确定WCF服务访问地址 http://servic ...
- Xamarin.Forms项目无法添加服务引用
Xamarin.Forms项目无法添加服务引用 创建的Xamarin.Forms项目中,右击“引用”选项,在弹出的菜单中没有“添加服务引用”命令.这是由于该项目是支持Windows Phone 8.1 ...
随机推荐
- ORA-04021
编译或删除存储过程的时候,系统会卡住,一段时间后出现ora-04021错误. 1.可能被锁住查看v$locked select b.sid,b.serial#,b.machine,b.terminal ...
- itext poi 学习之旅 (2)创建excel
Computer.java package com.qiang.poi; public class Computer { private int id; private String name; pr ...
- Linux中yum手动安装、手动建立仓库文件夹关联实现关联包自动安装、yum相关命令使用
yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器.基於RPM包管理,能够从指 ...
- CSS的margin塌陷
一.两个div并列,上面div的margin-bottom和下面div的margin-top会塌陷,也就说会取上面div的margin-bottom和下面div的margin-top的最大值作为两个并 ...
- Python番外之 阻塞非阻塞,同步与异步,i/o模型
1. 概念理解 在进行网络编程时,我们常常见到同步(Sync)/异步(Async),阻塞(Block)/非阻塞(Unblock)四种调用方式: 同步/异步主要针对C端: 同步: 所谓同步,就 ...
- ROM包内的大致框架及各个文件的作用[转]
1.system/app这个里面主要存放的是常规的应用程序,都是以apk格式结尾的文件,在这个文件夹下面的程序为系统默认的组件,个人安装的软件不会出现在这里,而是data文件夹中. 2.system/ ...
- FLASH驱动之-块设备驱动系统构架
一. 块设备是只能以块为单位进行访问的设备,块的大小一般是512个字节的整数倍,常见的块设备包括硬件,SD卡,光盘,flash等.驱动程序是块的整数倍从设备读写得到数据.块设备的最小访单位为块,不同 ...
- FJ省队集训DAY2 T2
思路:我们可以考虑三角剖分,这样问题就变成考虑三角形的选取概率和三角形内有多少个点了. 先用树状数组预处理出三角剖分的三角形中有多少个点,然后用线段树维护,先用原点极角排序,然后枚举i,再以i极角排序 ...
- LeetCode_Climbing Stairs
ou are climbing a stair case. It takes n steps to reach to the top. or steps. In how many distinct w ...
- 使用CPU的AVX指令
arch:AVX 很抱歉GCC还不行……有……倒是 但是不是这么写的 我忘记了……官网上有 http://www.oschina.net/news/66980/kreogist-0-9