????? C# .NET ??? ??? ???? ?? ??? ??? ???? ?? ??? ???? ??????

???? ?????? ???? ??????
???? ID: 318299 - ?? ???????? ?? ?????? ??? ?? ?? ???? ???? ???? ??.
??? ?? ??????? ???? | ??? ?? ??????? ????

?? ????? ??

??????

???:?? ???? ??? ????? .NET Framework ????? ????????? ???????? ???????? ?? ???:
  • System.Web.Services
  • System.Text
?? ??? ?? ??? ???? ????? ???? ?? ?? asp.NET ??? ???? ?????? ?????? ?? ????? ???? ?? ?? ?? ????? ????? ?? ??? ???? ????? ?????? ?????? caches ?? ???? ?? ??? ??? ???? ?? ?????? ???????? ????????????? ???? ????? ?? ??? ????????? ???????WebMethod.

???:ASP.NET 2.0, ??? HTTP ?????? ?? ??????? ????? ?? ???? GET ?? POST ???? ?? ???? ???????, ????? ??? ???? ??????? ??? ???? ??? ?? ????? ?? ????? ???? ?? ??? asp.NET 2.0 ??? ???? ????????? ??? ??????? ????? GET, ????? ?? ??? ??? ?? ???? ????? ???? ???? ??? ??, HTTP ?? ?? ??? ?????????? ????? (??????? ?? ?????? ?????????) ????? "????-???." ???? ?? ??? ????? ??? ???? ???????? ?? ??? ?? ?????? ?? ??????? ???? ??? ????? ???? ????? ?????, ASP.NET ????????? ??????? ????? ?????? ?? ?? "????-???" ????? ??? ???? ???????

??????????

????? ???? outlines ???????? ?????????, ??????????, ??????? ?????? ?? ?????? ??? ?? ???? ???:
  • Microsoft Windows 2000 Professional, Microsoft Windows 2000 ?????, Microsoft Windows 2000 ????? ????? ?? Microsoft Windows XP
  • Microsoft .NET ?????
  • Microsoft ??????? ????? ?????? (IIS)

??? ??? asp.NET ??? ???? ????????? ?????

??? ??? asp.NET ??? ???? ????????? WSCacheSample ??? ?????:
  1. Visual Studio .NET ?? ??????? ?????
  2. ????? ???????????? ??,????? ????-????? ????, ?? ???? ??????????????? ????????? ???????? ??????? ?????
  3. ?? ???????????????? ????????? ????????? C#. ?? ???????????????:??? ????ASP.NET ??? ????.
  4. ??????????????? ???, "WebService #" URL ?? ??? ?? ??? ???? ????????? ?? ???WSCacheSample. ??? ?? ??????? ????? ?? ????? ?? ??? ???, ?? ????? ??? http://localhost, ?? ??? ??? ??? ??? ?????????????? ?? ??? ?? ???? ????? ??:
    HTTP://localhost/WSCacheSample

????? ??? ???? ?????

  1. ?????? Explorer ???, ????????? ??? ?? ????-????? ????, ?? ????? ????add?? ????-????? ????, ?? ???? ?????? ???? ??????.
  2. ???, ?????? ?? ???CacheDemo.asmx?? ????-????? ????, ?? ???? ????????. ?????? ????? ??? ??? ???? ????? ???
  3. ??? ???? ?? ????-????? ????, ?? ???? ??? ????? ????????? ???.
  4. CacheDemo.asmx.cs ???? ????? ??? ????? ??? ??????? ?? ?????? ?? ??WebMethod??????? ???GetCacheEntryTime?? ??? ??CacheDuration?? 60 ??????
    [WebMethod(CacheDuration=60)]
    public string GetCacheEntryTime(string Name)
    {
    	StringBuilder sb = new StringBuilder("Hi ");
    	sb.Append(Name);
    	sb.Append(", the Cache entry was made at ");
    	sb.Append(System.DateTime.Now.ToString());
    	
    	return(sb.ToString());
    }
    						
    ???:: ?????? ??????? ??? ???,CacheDuration?? ??? ???WebMethod??????? ?????? ?? ?? ?? ?? ???? ???, 0 ?? ??? ???
  5. ??????? ????? ??? ?? ????? ???? ??StringBuilder???? ??????, ?? ??? ??? ?????? ????? ????System.Text??? ????? ??? ??? ???? ?? ??? ??????? ??? ????? ?? ??? ?? ???? ????? ??:
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Web;
    using System.Web.Services;
    using System.Text;
    						
    ???:: ???? ??????? ?? ??? ?? ???? ???StringBuilder???? ?? ???, ????? Microsoft ?????? ??????? (MSDN) ??? ???? ?? ????:
    StringBuilder ????
    (vs.71) http://msdn2.Microsoft.com/en-us/library/SYSTEM.Text.stringbuilder .aspx
  6. Visual Studio .NET IDE, ??? ????? ?????????? ?????????? ????????????? ??..
  7. ????? ???????????? ??,??? ??????????????? ?? ??????? ??????? ?????? ???

????????? ?? ??????? ????

?? ???? ????? ???? ??CacheDemo??? ????, ?????GetCacheEntryTimeWebMethod?? ?????? ?? ????? ?? ???CacheDuration??????? ??????:
  1. ?????? Explorer ???, ???? ?????CacheDemo.asmx?? ????-????? ????, ?? ???? ?????????? ??? ?????.

    ??????? ??? .asmx ????? ?? ????? ?? ??GetCacheEntryTimeWebMethod??????? ????? ?? ???? ??? ??? ?? ??????? ???? ?? ??? ??? ???????? ???? ???
  2. ????? ????GetCacheEntryTime????.
  3. ????????????, ?????? ?? ??? ????????? ????-????? ????, ?? ???? ?????????? ????????? ?? ???WebMethod??????? ?? ?? XML ?? ?????? ???? ?????? ????? ??? ??? ?? ??? ??????? ????? ???

    ???:: ??? WebServices ??? ????? ????? ???? ????, ??? ???? ???WebService??? ??? ??? ????? ??? ????? ???? ???? ???? ???????:
    http://localhost/wscachesample/cachedemo.asmx/GetCacheEntryTime?Name=Joe
    					
  4. ?????WebMethod???? ???? ???:??.???:: ??? ?? ?????WebMethod??????? ??? 60 ????? ??? ?? ???? ???? ?????? ????????? ??CacheDuration??????? ??, ??? ??? ??????? ????? ???
  5. ????? ?????? 4, ??? ?? ???????Amy??? ?? ?? ????????? ??? ?????WebMethod???????? ??????? ???

    ????? ??? ?? ??? ??????? ?????? ????? ??? ?? ?? ???? ?? ??????? ??????? ?????? ?????? ?????? ?? ???????? ?? ?????? ??WebMethod??????? ??? ?? ?????? ???,?????????? ??? ?? ???? ?? ??????? ?? ??? ??, ?? ????? ??????? ?? ??? ????? ?????? ???? ??? ??? ?? ?? ????? ????Amy????? ??????? ??? ?? ???? ?? ?????? ??????? ???? ??? ??? ?? 60 ????? ??? ??????? ???????, ?? ???? ????? ?????? ?????? ??????? ??????? ???????? ?? ??????? ?? ??? ?????? ??? ???? ?? ??????? ??WebMethod??????? ???

?????? ??????

?? ?? ???? ?? ???? ?????? ???? ??? ???? ?? ??? ??? ?? ??????????? ???? ?? ??? ???? ???????, ??? ?? ????? ?????? ?? ???? ?? ???????? ????????? ???WebMethod?????? ?? ??? ?????? ?? ?? ??????? ???????? widely ?????, ?? ??? ???????? ???? ?? ?????? ?? ??? ???????

??????

?? ???? ??? ???? ??????? ?? ???WebMethodAttribute.CacheDuration??? ??WebMethodAttribute????, .NET Framework ????? ??? ????? ???? ????? ????????? ????????:
WebMethodAttribute.CacheDuration ???
(vs.71) http://msdn2.Microsoft.com/en-us/library/SYSTEM.Web.services.webmethodattribute.cacheduration .aspx
??? ???? ?? ???? ??? ???????? ??????? ?? ??? ????? MSDN ??? ???? ?? ????:
XML ??? ?????? asp.NET ????? ????? ?? ??? ??????? ???????????
(vs.71) http://msdn2.Microsoft.com/en-us/library/w8excbb0 .aspx

WebMethod ??????? ?? ????? ????
(vs.71) http://msdn2.Microsoft.com/en-us/library/byxd99hx .aspx
???????? ?????, ????????, ?? ?????? ?? .NET Framework ?? ??? ???????????? ?? ??????? ???, ?? ??? ????? CodePlex ??? ???? ?? ????:
HTTP://www.codeplex.com

???

???? ID: 318299 - ????? ???????: 04 ?????? 2010 - ??????: 2.0
???? ???? ???? ??:
  • Microsoft ASP.NET 1.1
  • Microsoft ASP.NET 1.0
  • Microsoft ASP.NET 2.0
  • Microsoft Web Services Enhancements for Microsoft .NET 1.1
  • Microsoft Visual C# .NET 2002 Standard Edition
??????: 
kbcaching kbhowtomaster kbmt KB318299 KbMthi
???? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:318299

??????????? ???

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com