Tuesday, April 05, 2011

Implementing WCF .Net 4 on the windows 2008 R2 server

I recently came across one of those annoying deployment issues when I deployed my WCF project to a windows 2008 R2 server.

After much googling and scratching my head till I could feel my scalp going raw, I figured out that WCF activation needs to be added as a feature through the Server Manager.

When I actually figured that part out I was caught on a another mind-boggling experience. .Net framework 4 was not available via the Server Manager. But I look at the WINDOWS\Microsoft.NET\Framework folder and there was .Net 4.
Anyhow I figured this out too, you need to have the Microsoft .NET Framework 4 (Standalone Installer) for Server Core

So things to watch out for

1) .Net 4 (Server Core) edition is installed on the windows 2008 server
2) Make sure that you add the feature WCF Activation is added to the server.

Monday, March 21, 2011

Snippet editor

VS2010 doesn't come with inbuilt snippet editor but here is an excellent alternative

http://snippeteditor.codeplex.com/

Thursday, March 03, 2011

Here is a quick reference on using XDocument

Here is a quick reference on using XDocument


5


1) Loading an XML file into a Xdocument object

XDocument xdocSource = XDocument.Parse(Xmltmp);

2) Loading a string directly into a Xdocument object

XDocument xdocSource = XDocument.Load(XMLReader xr);

3) To get to a particular element you need to follow the path

XmlElement xe = xdocSource.Descendants(soap + "JobDetails").FirstOrDefault().Element(soap + "JobNumber");

4) To get the value of the above use the following
string tmp = xdocSource.Descendants(soap + "JobDetails").FirstOrDefault().Element(soap + "JobNumber").Value;