⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 service1.asmx.cs

📁 C#2005 实例源代码
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;

namespace HelloWorld_Service
{
	[WebService(
	Description="Web服务示例类,实现HelloWorld",
	Name="HelloWorld ",
	Namespace="http://www.myspace.com/myservices"
	)]
	public class HelloWorld : System.Web.Services.WebService
	{
		public HelloWorld()
		{
			//CODEGEN: 该调用是 ASP.NET Web 服务设计器所必需的
			InitializeComponent();
		}

		#region 组件设计器生成的代码
		
		//Web 服务设计器所必需的
		private IContainer components = null;
				
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if(disposing && components != null)
			{
				components.Dispose();
			}
			base.Dispose(disposing);		
		}
		
		#endregion

		// WEB 服务示例
		// HelloWorld() 示例服务返回字符串 Hello World
		// 若要生成,请取消注释下列行,然后保存并生成项目
		// 若要测试此 Web 服务,请按 F5 键

		[WebMethod(
			 Description="返回字符串HelloWorld",
			 CacheDuration=60
		)]
		public string SayHello()
		{
			return "Hello World";
		}


		[WebMethod(
			 Description="计算两个整数的和",
			 CacheDuration=0
		)]
		public int Add(int x, int y)
		{
			return x+y;
		}

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -