asp.netдµÄ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»ÊÇÖÊÊý by flysky 2008-04-25
/// </summary>
/// <param name="number">ÒªÅжϵÄÊý</param>
/// <returns>·µ»Ø½á¹û</returns>
[WebMethod(Description = "ÅжÏÒ»¸öÊýÊDz»ÊÇÖÊÊý")] //ÉùÃ÷´Ëº¯ÊýΪweb service·½·¨£¬¿ÉÒÔ¹©Íâ ½çµ÷ÓÃ
public string IsPrimeNumber(int number)
{
// ÒÔÏÂΪËã·¨£¬Ã²ËƲ»ÊÇ×îÓŵÄ
string value = "";
if (number <= 0)
{
value = number.ToString() + "is not prime number";
return value;
}
else
&
Ïà¹ØÎĵµ£º
ÔÚ×¢²á±í System->CurrentControlSet->Services->Eventlog ´¦Ñ¡ÔñÌí¼ÓϵͳÖÐ AspNet Õâ¸öÕË»§×¢ÒâÊÇÔÚÓÒ¼üµÄ °²È«->ȨÏÞ->Ìí¼Ó
дÈÕÖ¾
public static void Log(string sourceName, string message)
{
EventLog eventLog = null;
......
ÓÉÓÚasp.net ´¦Àí½ø³ÌÔÚmachine.configÅäÖÃÎļþÖеÄÅäÖÃΪ<processModel autoConfig="true" />£¬ÕâÒâζ×ÅÄãµÄasp.net Ó¦ÓóÌÐòʹÓõÄÐÔÄܲÎÊýÒÀÀµÓÚmachine.configµÄÅäÖá£
ÏÂÃæ¼¸¸ö²ÎÊýÊÇ×Ô¶¯ÅäÖõģº
maxWorkerThreads ºÍ maxIoThreads
minFreeThreads ºÍ minLocalRequestFreeThreads
minWorkerThreads
max ......
ͨ³£javascript´úÂë¿ÉÒÔÓëHTML±êǩһÆðÖ±½Ó·ÅÔÚǰ¶ËÒ³ÃæÖУ¬µ«Èç¹ûJS´úÂë¶àµÄ»°Ò»·½Ãæ²»ÀûÓÚά»¤£¬ÁíÒ»·½ÃæÒ²¶ÔËÑË÷ÒýÇæ²»ÓѺã¬Òò
ÎªÒ³ÃæÒò´Ë¶ø±äµÃÓ·Ö×£»ËùÒÔÒ»°ãÓÐÁ¼ºÃ¿ª·¢Ï°¹ßµÄ³ÌÐòÔ±¶¼»á°Ñjavascript´úÂë·Åµ½¶ÀÁ¢µÄjsÎļþÖУ¬ÆäËûÒ³ÃæÍ¨¹ýÒýÈë¸ÃjsÎļþÀ´Ê¹ÓÃÏàÓ¦µÄ
javascript´úÂë¡£
½ñÌìÔÚ×öÒ»¸öСÐÂÎÅϵͳµÄ¹ÜÀí ......
//postÇëÇó
string name = Request["name"].toString();
string name =Request.Form.Get("name").toString();
//getÇëÇó
string name = Request.QueryString["name"].toString();
µ«ÎÒ·¢ÏÖ ÎÞÂÛÊÇ·ñÊÇpostÓëget´«Öµ
¶¼¿ÉÓÃstring name = Request["name"].toString();
±íµ¥Ìá½»ÖÐgetºÍpost·½Ê½µ ......
·ÖÒ³´úÂëÈçÏ£¨PageHelper.cs£©£º
´úÂë
1 using System;
2 using System.Collections.Generic;
3 using System.Collections.Specialized;
4 using System.Linq;
5 using System.Web;
......