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

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

?? ??? ??????

??????

?????? ??? ??????? ????? ?????? ??????? ????? ?????? ???? ??? .NET ??????? ?? ??? ???????:
  • System.Web.Services
  • System.Text
???? ??? ??????? ???? ????? ??? ????? ????? ????? ???? ??? ASP.NET ?????? ??????? ??????. ??????? ?????? ?????? ??????? ??????? ????? ???? ??? ????? ??? ??? ????? ?????? ??????? WebMethod.

?????? ?? ASP.NET 2.0 ??? ?? ????? ????? HTTP ?? ???? ?????? ?? GET ??? POST. ??? ???? ?????? ????? ??? ?? ????? ??????. ??? ??? ?????? GET ???? ?????? ?? ????? ???? ??? ASP.NET 2.0 ??????? ??????? ?????? ???? ???? ????. ???????? ??? ???? ???? HTTP ??? ?? ???? ?????? (???????? ?? ????? ?????????) ??? ?? ???? ?????? ??? ????? ??????? ?????? ?????? ?????? ????? ????? Cache - Control (?????? ?? ??????? ?????? ??? "??? - ??????? ??????." ????? ????? ??????? ASP.NET ????? ??????? ?????? ??? ?????? ?????? ??? ??? "??? - ????? ??????? ??????".

???????

???? ??????? ??????? ??????? ?????? ??? ????? ?????? ???????? ?????? ? ??? ??????? ????????:
  • ????? Microsoft Windows 2000 Professional ?? ???? ??????? Microsoft Windows 2000 Server ?? ???? ??????? Microsoft Windows 2000 Server ?? Microsoft Windows XP
  • ???? ??? Microsoft .NET
  • ????? ??????? ???????? ?? Microsoft "(IIS)

????? ????? ???? ???? ??? ASP.NET

????? ????? ASP.NET ???? ??? ???? ???? WSCacheSample:
  1. ??? ????? Visual Studio .NET.
  2. ?? ??????? ???? ??? ??? ???? ?? ???? ??? Project ??? ??? ????? "????? Project ??????".
  3. ??? ????? Project ??? Visual C#. ??? ???? ? ??? ???? ??? ASP.NET.
  4. ?? ?????? ??????? ??????? "???? ??? #" ?? ???? URL ?? ??? ??????? WSCacheSample. ?? ???? ??????? ???? ???? ????? ??? ?????? http://localhost ? ???? ???? ???? ?????? ?????? ????:
    http://localhost/WSCacheSample

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

  1. ?? "?????? ??????" ???? ??? ?????? ?????? ??? ???? ??????? ??? ??? ????? ?? ?? ???? ??? ????? ???? ???.
  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
    http://msdn2.microsoft.com/en-us/library/system.text.stringbuilder(vs.71).aspx
  6. ?? IDE .NET Visual Studio ? ???? ??? "????? ????" ?? ??????? ????.
  7. ?? ??????? ???? ???? ??? ??? ???? ???? ??????? ???????? ????????.

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

????? ????? ???? ??? CacheDemo ????? ????? GetCacheEntryTimeWebMethod ??????? ??????? ????? ????? CacheDuration:
  1. ?? "?????? ??????" ???? ??? ?????? ?????? ??? CacheDemo.asmx ??? ?? ???? ??? ??? ?? ????????.

    ??? ??? ????? .asmx ?? ???????? ?? ??? ??? ?????? WebMethodGetCacheEntryTime ??? ???? ???? ?? ????? ?????? ?? ??????.
  2. ???? ??? ???????? GetCacheEntryTime.
  3. ?? ?????? ??? ??????? ???? ???? ??? ?? ???? ??? ??????? ????? ????? WebMethod ?????? ??????? XML. ???? ?????? ?????? ???? ??? ?????? ?? ???????.

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

    ???? ?? ???? ??????? ???? ????? ??????. ???? ??? ???? ??????? ????????? ??????? ?????? ????? ????? ??? ?????? ????? WebMethod. ?? ??? ??????? ???? ??? ???? ??????? ?????????? ??????? ???? ????? ????? ??????? ?????? ???????? ??????. ??? ??????? Amy ?? ?????? ?????? ???? ????? ?????. ??? ??? ??? ???????? ?? 60 ????? ??? ????? ????? ??????? ?????? ?????. ????? ????? ?? ????? ??????? ?????? ??????? ??????? ??? WebMethod.

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

????? ???? ?? ??? ??? ???? ????? ??????? ?????? ????? ??? ?? ?? ???? ??? ?????? ????? ???? ?? ????? ????? ??? ????? ?????? ????? WebMethod ???????? ?? ??????? ?? ??? ???? ????? ?????????? ????? ????? ?? ????????.

?????

?????? ??? ???? ?? ????????? ??? ??????? WebMethodAttribute.CacheDuration ??? WebMethodAttribute ???? ??????? ?????? ?? ??? .NET Framework ????? ?????:
????? WebMethodAttribute.CacheDuration
http://msdn2.microsoft.com/en-us/library/system.web.services.webmethodattribute.cacheduration(vs.71).aspx
?????? ??? ??????? ?????? ??? ????? ??? ?????? ????? ??? MSDN ??????:
??????? ??????? ?????? ??? XML ????? ??????? ASP.NET
http://msdn2.microsoft.com/en-us/library/w8excbb0(vs.71).aspx

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

???????

???? ???????: 318299 - ????? ??? ??????: 15/?????/1428 - ??????: 6.5
????? ???
  • 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 Web Services (included with the .NET Framework) 1.0
  • Microsoft Visual C# .NET 2002 Standard Edition
????? ??????: 
kbmt kbcaching kbhowtomaster KB318299 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????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