Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

asp.net¿Í»§¶Ë½Å±¾µ÷ÓÃwebservice

 ÓÉÓÚ asp.net ajax ·â×°Á˺ܶàºÜºÃµÄ·½·¨£¬ËùÒÔʹÓÃÕâ¸ö¿ò¼Üµ÷ÓÃwebwervice±äµÄ·Ç³£¼òµ¥¡£
µÚÒ»²½
webservice ÀàµÄ·½·¨ÐèÒªÓÐscriptServiceµÄ  attribute.
 namespace ServiceTest
{
/// <summary>
///WebService µÄժҪ˵Ã÷
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
//ÈôÒªÔÊÐíʹÓà ASP.NET AJAX ´Ó½Å±¾Öе÷ÓÃ´Ë Web ·þÎñ£¬ÇëÈ¡Ïû¶ÔÏÂÐеÄ×¢ÊÍ¡£
// [System.Web.Script.Services.ScriptService]
public class MyWebService : System.Web.Services.WebService
{
public MyWebService()
{
//Èç¹ûʹÓÃÉè¼ÆµÄ×é¼þ£¬ÇëÈ¡Ïû×¢ÊÍÒÔÏÂÐÐ
//InitializeComponent();
}
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
µÚ¶þ²½
ÔÚ¿Í»§¶ËʹÓÃscriptmanagerÀ´ ÉèÖÃwebserviceµÄ·¾¶
<asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Debug">
<Services>
<asp:ServiceReference Path="WebServiceFoundation.asmx" InlineScript="true" />
</Services>
</asp:ScriptManager>
 µÚÈý²½
½Å±¾µ÷ÓÃ
ÃüÃû¿Õ¼ä.ÀàÃû.·½·¨Ãû (»Øµ÷·½·¨);
<mce:script language="javascript"><!--
function callWebService()
{
ServiceTest.MyWebService.HelloWorld(getResult);
}

function getResult(result)
{
alert(result);
}



// --></mce:script>
µ±µ÷ÓàwebserviceÊdzöÏÖ´íµÄ´¦Àí¡£
Õâ¸öÆäʵÊÇ·â×°ºÃµÄ¡£
¿ò¼ÜÉú³ÉµÄ¿Í»§¶Ë½Å±¾Óм¸¸ö²ÎÊý
 Ö»Òª½«Õ⼸¸ö»Øµ÷º¯ÊýÉèÖúþÍok ÁËÔڻص÷º¯ÊýÖд¦Àí´íÎó


Ïà¹ØÎĵµ£º

ASP.NETÉú³ÉËæ»úÃÜÂë

 ASP.NETÉú³ÉËæ»úÃÜÂë
ÔÚ¿ª·¢ÐèÒªÓû§×¢²áºó²ÅÄÜʹÓÃÌṩµÄ¸÷ÏÄܵÄÓ¦ÓóÌÐòʱ£¬ÔÚÐÂÓû§Ìá½»×¢²áÐÅÏ¢ºó£¬½Ï³£¼ûµÄ×ö·¨ÊÇÓɳÌÐòÉú³ÉËæ»úÃÜÂ룬Ȼºó·¢ËÍÃÜÂëµ½Óû§×¢²áʱÌîдµÄµç×ÓÐÅÏ䣬Óû§ÔÙÓÃÊÕµ½µÄÃÜÂëÀ´¼¤»îÆäÕÊ»§¡£
ʵÏÖASP.NETÉú³ÉËæ»úÃÜÂ빦ÄÜÊǺÜÈÝÒ׵ģ¬ÏÂÃæµÄ´úÂë¸ø³öÁËÍêÕûµÄʵÏÖ·½·¨£º
publicstatic ......

Asp.Net¼Ì³ÐʵÏÖÉí·ÝÑéÖ¤

 ÔÚASP.NETÍøÕ¾ÖÐÍøÕ¾¹ÜÀíºǫ́ÐèÒª¾­³£ÑéÖ¤Óû§Éí·Ý,ҪʵÏÖÕâÖÖ¹¦ÄܾͿÉÒÔÀûÓÃÄǸö¼Ì³Ð»úÖƺÍASP.NETµÄʼþ»úÖÆ.Ê×Ïȶ¨ÒåÒ»¸öÐèÒª½øÐÐÉí·ÝÑéÖ¤µÄBasePageÀà,¼Ì³Ð×ÔPageÀà,ÔÚBasePageÀàµÄ¹¹Ô캯ÊýÖж¨ÒåËüµÄ¼ÓÔØʼþµÄ´¦Àí´úÂë,ÕâÑùËùÓм̳Ð×ÔBasePageÀàµÄÒ³Ã涼ÄÜ×Ô¶¯Ö´ÐÐÉí·ÝÑéÖ¤£º
/// <summary>
/// ÑéÖ ......

ASP.NET·µ»ØÉÏÒ»Ò³ÃæʵÏÖ·½·¨×ܽá

 ·µ»ØÉÏÒ»Ò³µÄÕâ¸ö¶«¶«ÔÚÎÒÃÇ×öÏîÄ¿µÄʱºòÒ»°ãÊÇÓÃÓÚÌîдÍê±íµ¥ºóÈ·ÈϵÄʱºò£¬ÓжÔÔ­À´ÊäÈëµÄÊý¾Ý½øÐÐÐ޸ĻòÕ߸üÐÂʱÓõģ¬»òÕßÊÇÒòΪÍøվΪÁË·½±ãä¯ÀÀÕ߶øÓÐÐÄÌí¼ÓµÄÒ»¸ö¶«¶«£¬Ò»°ãÕâÖÖ¹¦ÄܵÄʵÏÖÔÚASP.NETÖж¼ÊÇÓÃÒ»¸öButton¿Ø¼þÀ´ÊµÏֵģ¬ÊµÏֵķ½·¨Óкܶ࣬½ñÌìÇ¡ºÃÔÚ×öÏîĿʱÅöµ½ÒªÓÃÕâ¸ö¶«¶«£¬ÎҾͰÑÄÜʵÏÖ" ·µ» ......

ASP.NET½Ì³Ì:µ÷ÓÃWebServiceµÄÔ´Âë


WebjxComÌáʾ£ºÕâÀïÒ»¶¨ÒªÌí¼ÓWEB ÒýÓò˵¥²½ÖèÈçÏÂproject->add web reference...£¬È»ºóÊäÈëÎÒÃÇWeb ServiceµÄ·¾¶£¬ÕâÀïÊÇhttp://localhost/WebService1/Service1.asmx£¬µã»÷Ìí¼Ó¾ÍOKÁË¡£ÕâʱÄ㽫ÔÚÀàÊÓͼÖп´µ½localhostÃüÃû¿Õ¼äÁË¡£
ÕâÀïÒ»¶¨ÒªÌí¼ÓWEB ÒýÓò˵¥²½ÖèÈçÏÂproject->add web reference...£¬È»ºóÊä ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ