asp.net web serviceʵÀý
×î½üÏëÑо¿ÏÂweb service,ÄκÎÕÒ±éÍøÂ磬¶¼Êǽ²Ð©¶¨ÒåÐԵĶ«Î÷£¬·º·º¶ø̸£¬ÎÒ¿´µÄÒ»Öª°ë½â£¬²»µÃÒªÁì¡£²»¹ý½ñÌì×ÜËãÓеãÊÕ»ñ£¬Ð´ÁË ¸öСµÄweb serviceÀý×Ó£¬¾ÍÊÇÅжÏÒ»¸öÊýÊDz»ÊÇÖÊÊý¡£»¹ÊÇÀÏ»°£¬¸ø´ó¼ÒÆðÅ×שÒýÓñµÄ×÷Óã¬Ö»ÊǸø´ó¼Ò½²½âÈçºÎ¿ª·¢×î¼òµ¥µÄweb service³ÌÐò ¡£Ö»ÒªÈëÁËÃż÷£¬ÒÔºóµÄ·¾Í¿ÉÒÔ×Ô¼º×ßÁË¡£
µÚÒ»£¬ н¨ÍøÕ¾£¬Ñ¡ÔñÀàÐÍΪasp.net web ·þÎñ¡£
ϵͳ×Ô¶¯ÎªÄ㽨Á¢Á˸öÎļþservice.asmx.Õâ¾ÍÊÇÒ»¸ö×î¼òµ¥µÄweb service·þÎñ¡£Äã¿ÉÒÔÖ±½ÓÔËÐв鿴Ч¹û¡£
µÚ¶þ£¬ÎÒÃÇÐèÒªµÄÊÇÐÞ¸Äservice.csÖеĴúÂ룬À´Âú×ãÎÒÃǵÄÒªÇó¡£
Ð޸ĺóµÄService.csÖеĴúÂëΪ£º
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
[WebService(Namespace = "http://127.0.0.1/")] //µ÷ÓôËweb serviceµÄµØÖ·
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service () {
//Èç¹ûʹÓÃÉè¼ÆµÄ×é¼þ£¬ÇëÈ¡Ïû×¢ÊÍÒÔÏÂÐÐ
//InitializeComponent();
}
//[WebMethod]
//public string HelloWorld() {
// return "Hello World";
//}
/// <summary>
/// ÅжÏÒ»¸öÊýÊDz»ÊÇÖÊÊý
/// </summary>
/// <param name="number">ÒªÅжϵÄÊý</param>
/// <returns>·µ»Ø½á¹û</returns>
[WebMethod(Description = "ÅжÏÒ»¸öÊýÊDz»ÊÇÖÊÊý")] //ÉùÃ÷´Ëº¯ÊýΪweb service·½·¨£¬¿ÉÒÔ¹©Íâ ½çµ÷ÓÃ
public string IsPrimeNumber(int number)
{
// ÒÔÏÂΪËã·¨£¬Ã²ËƲ»ÊÇ×îÓŵÄ
string value = "";
if (number <= 0)
{
&
Ïà¹ØÎĵµ£º
ÌõÐÎÂëÊÇÆù½ñΪֹ×á¢ÊµÓõÄÒ»ÖÖ×Ô¶¯Ê¶±ð¼¼Êõ¡£ÌõÐÎÂë¼¼Êõ¾ßÓÐÒÔϼ¸¸ö·½ÃæµÄÓŵã
¡¡¡¡A£®ÊäÈëËٶȿ죺Óë¼üÅÌÊäÈëÏà±È£¬ÌõÐÎÂëÊäÈëµÄËÙ¶ÈÊǼüÅÌÊäÈëµÄ5±¶£¬²¢ÇÒÄÜʵÏÖ“¼´Ê±Êý¾ÝÊäÈ딡£
¡¡¡¡B£®¿É¿¿ÐԸߣº¼üÅÌÊäÈëÊý¾Ý³ö´íÂÊΪÈý°Ù·ÖÖ®Ò»£¬ÀûÓùâѧ×Ö·ûʶ±ð¼¼Êõ³ö´íÂÊΪÍò·ÖÖ®Ò»£¬¶ø²ÉÓÃÌõÐÎÂë¼¼ÊõÎóÂëÂʵ ......
ASP.NETÖ¸ÁîÔÚÿ¸öASP.NETÒ³ÃæÖж¼ÓС£Ê¹ÓÃÕâЩָÁî¿ÉÒÔ¿ØÖÆASP.NETÒ³ÃæµÄÐÐΪ¡£ÏÂÃæÊÇPageÖ¸ÁîµÄÒ»¸öÀý×Ó£º
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" %>
ÔÚASP.NETÒ³Ãæ»òÓû§¿Ø¼þÖÐÓÐ11¸öÖ¸Áî¡£ÎÞÂÛÒ³ÃæÊÇʹÓúǫ́±àÂëÄ£ÐÍ»¹ÊÇÄÚÖñ ......
Ò»¡¢Page Àà
Page ÀàÓëÀ©Õ¹ÃûΪ .aspx µÄÎļþÏà¹ØÁª£»ÕâЩÎļþÔÚÔËÐÐʱ±»±àÒëΪ Page ¶ÔÏ󣬲¢±»»º´æÔÚ·þÎñÆ÷ÄÚ´æÖС£Èç¹ûÊÇʹÓôúÂëÒþ²Ø¼¼Êõ´´½¨ Web ´°ÌåÒ³£¬Çë´Ó¸ÃÀàÅÉÉú¡£
Àý£º£¨public partial class _Default : System.Web.UI.Page£©
Page ¶ ......
///<summary>
///±¸·ÝÊý¾Ý¿âµ½±¾µØ´ÅÅÌ
///</summary>
public bool BackUp(string BackUpFile)
{
try
&nbs ......