首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

一个接口文件“IService”,该怎么解决

2012-03-24 
一个接口文件“IService”接口文件“IService”:namespace _11.LINQtoSQL.Web{// NOTE: You can use the Rena

一个接口文件“IService”
接口文件“IService”:

namespace _11.LINQtoSQL.Web
{
  // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
  [ServiceContract]
  public interface IService1
  {
  [OperationContract]
  List<Product> GetChartData();
  }
}

问题一:“ServiceContract”是什么???他的作用是什么???

问题二:“OperationContract”是什么???他的作用是什么???

[解决办法]
http://xyztony1985.blog.163.com/blog/static/36117820090592128676/
http://topic.csdn.net/u/20110412/13/3137206e-9ad3-4c39-b152-21f9a82d7da6.html
[解决办法]
自定义标签
[解决办法]
这是WCF定义契约时候的标签。
[ServiceContract] 标识的接口会被WCF暴露给外部以供调用。
[OperationContract] 用来标记暴露给外部的方法。
[解决办法]
WCF 包含 WebService,WebService 在.net 4.0已经没有Project Template了。

比如你用 WCF 的 wsHttpBinding, basicHttpBinding 这两种绑定时,其实就是 WebService 了。

热点排行