开发者

Can an ASP.NET 2.0 Web site reference WCF Web Services?

Our company currently has a web site which is deployed in Windows 2000 OS, which means that we could only install .NET 2.0 on that machine. Upgrading the Webserver OS is out of the question, since this web server also hosts other web applications in our country. As also part of our IT's policy, for security reasons the web sites are not allowed to directly access dat开发者_开发问答a to our database. That 's why to comply with this restrictions, We have another Server where the Web services is deployed. This "app server" currently has .Net 3.5 SP1 installed, hence WCF Services is possible.

My question is if it is possible to add a web reference on WCF Web services through our ASP.NET Web site that hosts only .NET 2.0.


Of course you can. If the WCF service uses the basicHttpBinding binding, then it will be compatible with all SOAP 1.1 clients, including "Add Web Reference".


I did this a fair bit of time ago, it is possible, but here's some stumbling blocks that i had to overcome

  1. Use [XmlSerializer] instead of DataContractSerializer, .net 2.0 does not include System.Runtime.Serialization 3.0, which is neccessary to use [DataContract] attibute, which is a .net 3.0 namespace, and for some reason .net 2.0 cant read XML encoded using DataContractSerializer
  2. when you declare your service contracts, ie. [ServiceContract] also declare the attribute [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1, EmitConformanceClaims = true)]
  3. You can encrypt the data using Transport security, requires a working certificate
  4. Generate Service reference using svcutil, use this switch when doing so /targetClientVersion:Version30
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜