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

WCF Óë Asp.net Web service ±È½Ï

Ê×Ïȼòµ¥½éÉÜһϠWCF ÊÇʲô£¬È»ºóÔÙ¶Ô WCF ºÍ Asp.net Web service ×ö¸ö±È½Ï¡£
    Windows Communication Foundation (WCF) ÊÇÓÃÓÚ¹¹½¨ÃæÏò·þÎñµÄÓ¦ÓóÌÐòµÄ¿ò¼Ü¡£½èÖú WCF£¬¿ÉÒÔ½«Êý¾Ý×÷ΪÒì²½ÏûÏ¢´ÓÒ»¸ö·þÎñÖÕ½áµã·¢ËÍÖÁÁíÒ»¸ö·þÎñÖÕ½áµã¡£·þÎñÖÕ½áµã¿ÉÒÔÊÇÓÉ IIS ³ÐÔصijÖÐø¿ÉÓõķþÎñµÄÒ»²¿·Ö£¬Ò²¿ÉÒÔÊÇÓ¦ÓóÌÐòÖгÐÔصķþÎñ¡£ÖÕ½áµã¿ÉÒÔÊÇ´Ó·þÎñÖÕ½áµãÇëÇóÊý¾ÝµÄ·þÎñ¿Í»§¶Ë¡£ÏûÏ¢¿ÉÒÔÊÇ´ÓÒÔ XML ¸ñʽ·¢Ë͵ĵ¥¸ö×Ö·û»òµ¥´Ê£¬µ½¸´ÔӵĶþ½øÖÆÊý¾ÝÁ÷¡£ËäÈ»ÔÚWCF ³öÏÖ֮ǰҲ¿ÉÒÔ¿ª·¢Ó¦Ó㬵«ÊÇ WCF µÄ³öÏÖʹ´ËÀàÓ¦ÓõĿª·¢±äµÃ¸ü¼Ó¼òµ¥¡£
    Asp.net Web service ͨ³£ÒÀÀµÓÚ XmlSerializer ½« .NET Framework µÄÊý¾ÝÀàÐÍת»»Îª XML ¸ñʽÔÚ·þÎñÖд«ËÍ£¬»ò½«´Ó·þÎñÖнÓÊÕµÄ XML ¸ñʽµÄÊý¾Ýת»»Îª .NET Framework ÖеĶÔÏó¡£
ʹÓà XmlSerializer ÐòÁл¯»ò·´ÐòÁл¯ .NET Framework µÄÊý¾ÝÀàÐÍʱµÄȱµã£º
1¡¢Ö»Óбê¼ÇΪ public µÄ×ֶκÍÊôÐÔÄܹ»±»ÐòÁл¯¡£
2¡¢Ö»ÓÐʵÏÖÁË IEnumerable ºÍ ICollection ½Ó¿ÚµÄÀàµÄ¼¯ºÏ²ÅÄܱ»ÐòÁл¯¡£
3¡¢ÊµÏÖ IDictionary ½Ó¿ÚµÄÀ಻Äܱ»ÐòÁл¯£¬ÈçHashtable¡£
    WCF ʹÓà DataContractAttribute ºÍ DataMemberAttribute À´±ê¼Ç¿ÉÒÔ±»ÐòÁл¯µÄ .NET Framework ÀàÐÍ¡£
[DataContract]
public class Item
{
[DataMember]
public string ID;
[DataMember]
public decimal Qty;
[DataMember]
public decimal Price;
}
DataContractAttribute ¿ÉÒÔÓ¦ÓÃÓÚÀà»ò½á¹¹ÌåÉÏ£¬DataMemberAttribute¿ÉÒÔÓ¦ÓÃÓÚ±ê¼ÇΪ public »ò private µÄ×ֶκÍÊôÐÔÉÏ¡£
DataContractSerializer ºÍ XmlSerializerµÄÇø±ð£º
1¡¢DataContractSerializer ²»¶Ô .NET Framework ÖеÄÊý¾ÝÀàÐÍÔÚ XML Öеıíʾ·½Ê½×÷¿ØÖÆ£¬Òò´ËÐÔÄÜÒª±È XmlSerializer ¸ß¡£
2¡¢XmlSerializer ²»ÄÜÈ·¶¨ÒªÐòÁл¯µÄ×ֶλòÊôÐÔ£¬¶ø DataContractSerializer ʹÓà DataMemberAttribute ¿ÉÒÔÃ÷È·µÄÈ·¶¨ÒªÐòÁл¯µÄ×ֶλòÊôÐÔ¡£
3¡¢DataContractSerializer ¿ÉÒÔÐòÁл¯ÊµÏÖÁË IDictionary ½Ó¿ÚµÄÀà¡£
4¡¢ÓÉÓÚ DataContractSerializer ¿ÉÒÔ·ÃÎʶÔÏóµÄ·Ç public ³ÉÔ±£¬Òò´ËÔÚ·´ÐòÁл¯Ê±ÐèÒªÔËÐÐÔÚÍêÈ«ÐÅÈÎģʽÏ£¬¶ø XmlSerializer ²»ÐèÒª¡£
 
·þÎñµÄ¿ª·¢
ÔÚ¿ª·¢ Asp.net Web service ʱÐèÒªÔÚÀàÉÏÃæÌí¼Ó WebService ÊôÐÔ£¨attribute£©£¬ÔÚÀàµÄ·½·¨ÉÏÌí¼Ó WebMethodAttribute ¡£
[


Ïà¹ØÎĵµ£º

URL µÄ¸÷¸ö²¿·ÖºÍͨ¹ýASP.NET»ñÈ¡URLµØÖ·µÄ·½·¨


網Ö·£ºhttp://localhost:1897/News/Press/Content.aspx/123?id=1#toc
Request.ApplicationPath
/
Request.PhysicalPath
D:\Projects\Solution\web\News\Press\Content.aspx
System.IO.Path.GetDirectoryName(Request.PhysicalPath)
D:\Projects\Solution\web\News\Press
Request.PhysicalApplicationPath
D ......

ASP.NET 2.0ÖÐGridViewÎÞÏ޲㸴ÔÓ±íÍ·µÄʵÏÖ

ʵÏÖ·½·¨¾ÍÊǸøµ¥Ôª¸ñÌî³äÎÒÃÇÏëÒªµÄ¸ñʽ´úÂë¡£
 
 
==============C#==============
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script run ......

ASP.NET Cookies¼òµ¥Ó¦Óà ¼ÇסÓû§ÃûºÍÃÜÂë

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
namespace TLibrary.ObjectHelper
{
    public class CookiesHelper
    {
        #region  ......

¡¶ASP.NET MVC ÈëÃÅϵÁн̡̳·Ë÷ÒýÌù

ʲôÊÇMVCģʽ
MVC£¨Model-View-Controller£¬Ä£ÐÍ—ÊÓͼ—¿ØÖÆÆ÷ģʽ£©ÓÃÓÚ±íʾһÖÖÈí¼þ¼Ü¹¹Ä£Ê½¡£Ëü°ÑÈí¼þϵͳ·ÖΪÈý¸ö»ù±¾²¿·Ö£ºÄ£ÐÍ£¨Model£©£¬ÊÓͼ£¨View£©ºÍ¿ØÖÆÆ÷£¨Controller£©¡£
ÄÇôMVCģʽºÍÎÒÃÇÊìϤµÄWebFormģʽÓÐʲô²»Í¬ÄØ£¿ËûµÄ¸÷¸ö²¿·ÖÓÖÊÇÔõÑù·Ö¹¤µÄÄØ£¿
ÎÒÃÇÏÈÀ´¿´Ò»ÏÂÆÕͨµÄWebFormģʽÏ£ ......

ASP.NETÖÐÈÃͼƬÒÔ¶þ½øÖƵÄÐÎʽ´æ´¢ÔÚÊý¾Ý¿âÖÐ


 ½ñÔçÓиöÍøÓÑÎʵ½ÎÒÕâÎÊÌ⣬ÒÔÇ°ÎÒ¶¼ÊÇÖ±½ÓÔÚÊý¾Ý¿âÖдæÎļþÃûµÄ£¬»¹Ã»ÓÐÊÔ¹ý´æ´¢ÕûÕÅͼƬµ½Êý¾Ý¿âÖУ¬ÉÏÍøËÑË÷ÁËһϣ¬×Ô¼ºÓÖ²âÊÔÁËÒ»·¬£¬´úÂëÈçÏ£º
½¨Á¢±£´æͼƬµÄ±íµÄSQLÓï¾ä£º
 
Sql´úÂë < width="14" height="15" src="javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://w ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ